I was working on a basic results display query of a database but I can only get one result to be displayed when I want it to display them all(there are currently 3 records). Any help would be greatly appreciated.
Here is my code:
<?php // query.php
require_once 'login.php';
$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if (!$db_server) die("Unable to connect to MySQL: " . mysql_error());
mysql_select_db($db_database)
or die("Unable to select database: " . mysql_error());
$query = "SELECT *
These two lines of codes(above and below) are joined, but for some reason the word "F R O M" in the middle was causing an error with posting... I can't even post it here without the spaces... weird.
gryphines";
$result = mysql_query($query);
if (!$result) die ("Database access failed: " . mysql_error());
$rows = mysql_num_rows($result);
for ($j = 0 ; $j < $rows ; ++$j);
{
$row = mysql_fetch_row($result);
echo 'ID: ' . $row[0] . '<br />';
echo 'Name: ' . $row[1] . '<br />';
echo 'Owner: ' . $row[2] . '<br />';
echo 'Gender: ' . $row[3] . '<br />';
echo 'Species: ' . $row[4] . '<br />';
echo 'Traits: ' . $row[5] . '<br />';
echo 'Colours: ' . $row[6] . '<br />';
echo 'Mother: ' . $row[7] . '<br />';
echo 'Father: ' . $row[8] . '<br />';
echo 'Children: ' . $row[9] . '<br />';
echo 'Pack: ' . $row[10] . '<br />';
echo 'Other: ' . $row[11] . '<br />';
echo 'Image: ' . $row[12] . '<br /><br />';
}
mysql_close($db_server);
?>