"Gurk" <gu******@hotmail.com> wrote in message
news:41**********************@news.skynet.be...
hallow
why won't this code let me show the first line on my db
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf("ID: %s Name: %s", $row[0], $row[1]);
}
i have 3 lines in my db and it shows me 2
i hope someone can help me out.
$result = mysql_query("SELECT id , name FROM mytable");
if(! $result || mysql_error() || mysql_num_rows($result) < 1)
{
echo "Unable to fetch records!"
}
else
{
printf("%s rows found<br>\n" ,mysql_num_rows($result));
while($row = mysql_fetch_array($result , MYSQL_NUM))
{
printf("ID: %s Name: %s<br>\n", $row[0], $row[1]);
}
}