Its syntax is: int mysql_result (int result_id, int row [, mixed field])
<?
@mysql_connect("localhost", "root","") or die("Could not connect to MySQL server!");
@mysql_select_db("mydatabase") or die("Could not select database!");
$query = "SELECT * FROM mytable";
$result = mysql_query($query);
$x = 0;
print "<table>";
print "<tr><th>ID</th><th>Title</th><th>MyValue</th></tr>";
while ($x < mysql_numrows($result)) :
$id = mysql_result($result, $x, 'id');
$name = mysql_result($result, $x, 'title');
$price = mysql_result($result, $x, 'myvalue');
print "<tr>";
print "<td>$id</td><td>$title</td><td>$myvalue</td>";
print "</tr>";
$x++;
endwhile;
</table>
mysql_close();
?>
|