Pennimus
12-25-2005, 11:17 PM
Hi,
I'm using the following code to output the contents of my database, which is working fine apart from the fact that it seems to be ignoring the first result.
$sql=mysql_connect ($host, $user, $pass) or die (mysql_error());
mysql_select_db ($data) or die (mysql_error());
$result = mysql_query ("SELECT tag, name, description FROM `tricktionary` WHERE alpha='a' ORDER BY `name` ASC") or die(mysql_error());
$trick = mysql_fetch_array ($result);
while($trick = mysql_fetch_array($result)){
echo '<div class="focus"><h2 id="'. $trick['tag'] .'">'. $trick['name'] .'</h2><p>'. $trick['description'] .'</p></div>';}
I've triple checked that the actual database entry in question has a value of 'a' for 'alpha', which it does, so is there something wrong with the while statement?
Thanks
Adam
PS: Merry christmas!
I'm using the following code to output the contents of my database, which is working fine apart from the fact that it seems to be ignoring the first result.
$sql=mysql_connect ($host, $user, $pass) or die (mysql_error());
mysql_select_db ($data) or die (mysql_error());
$result = mysql_query ("SELECT tag, name, description FROM `tricktionary` WHERE alpha='a' ORDER BY `name` ASC") or die(mysql_error());
$trick = mysql_fetch_array ($result);
while($trick = mysql_fetch_array($result)){
echo '<div class="focus"><h2 id="'. $trick['tag'] .'">'. $trick['name'] .'</h2><p>'. $trick['description'] .'</p></div>';}
I've triple checked that the actual database entry in question has a value of 'a' for 'alpha', which it does, so is there something wrong with the while statement?
Thanks
Adam
PS: Merry christmas!