I have a php script here that workd fine, but it prints out all the field in the table.
I would like to have it only print out one of the fields.
The fields in the table are;
mainpage_id
mainpage_content
mainpage_insert_date
owner_id
I would like it to only display the contents of the field "mainpage_content"
I am not sure how to change the following script to do this.
<html><head></head>
<body>
<?php
$db_host = "xxxxxx";
$db_user = "xxxxxx";
$db_pwd = "xxxxxx";
$db_name = "xxxxxx";
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
$result = mysql_query("SELECT * FROM mainpage_table WHERE mainpage_insert_date > DATE_SUB(NOW(),INTERVAL 4 DAY)ORDER BY mainpage_insert_date") or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are $num_rows records.<P>";
print "<table width=200 border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=arial size=1/>$field</font></td>
\n";
print "</tr>\n";
}
print "</table>\n";
mysql_close($link);
?>
</body>
</html>
Start Free Trial