Forum Moderators: open
ID--Name--Town
0---Tom---Here
1---Harry-There
2---Sally-Everywhere
I want to pull out the info with ID 1 (Harry's) but I want to preface it with the file name it will display like so:
Name: Harry
Town: There
I've been trying to use this:
$query = ("SELECT * FROM `table`);
$result = mysql_query($query);
$nrows = mysql_num_rows($result);
if($nrows!= 0)
{
print "<p>Data for " . $name;
print "<table border=2><tr><th>Info\n";
for($j=0;$j<$nrows;$j++)
{
$row = mysql_fetch_array($result);
print "<tr><td>";
print "$row[ID];<br>";
print "mysql_field_name($result, 1).$row[name];<br>";
print "$row[city];";
print "</td></tr>";
}
print "</table>\n";
}
But it prints out as:
mysql_fetch_field(Resource id #3, 1) Harry
instead of as Name Harry.
How can I fix this?