crawlerbasher Posted May 22, 2010 Share Posted May 22, 2010 What could cause a script to miss 1 database entry. I've got 5 database entry and the script only shows 4. And for some resion it always misses id number 2 but when its edited in the mysql then another database entry goes missing. $con = mysql_connect($db_server, $db_username, $db_password); // Connects to your database if (!$con) { die('Could not connect: ' . mysql_error()); // error message when failed to connect. } mysql_select_db($db_name) or die(mysql_error()); $query = "SELECT * FROM GalkaDownloads ORDER BY `name` ASC"; $result = mysql_query( $query ); $data = mysql_fetch_assoc($result); while($data = mysql_fetch_assoc($result)) { ?> <tr> <td align="left" valign="top" bgcolor="#FFFFFF"><a href="download.php?id=<?php echo $data['id']; ?>"><?php echo $data['name']; ?></a></td> <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo $data['Category']; ?></td> <td align="center" valign="top" bgcolor="#FFFFFF"><strong><?php echo $data['count']; ?></strong></td> <td align="left" valign="top" bgcolor="#FFFFFF"><?php echo nl2br($data['information']); ?></td> </tr> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/202592-php-missing-1-database-entry/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 22, 2010 Share Posted May 22, 2010 $data = mysql_fetch_assoc($result); ^^^ Why are you reading and discarding the first row from the result set with the above line of code ^^^ Quote Link to comment https://forums.phpfreaks.com/topic/202592-php-missing-1-database-entry/#findComment-1061996 Share on other sites More sharing options...
crawlerbasher Posted May 22, 2010 Author Share Posted May 22, 2010 ok that seems to have fixed it. Because I've been cutting and pasting other coding I've done in other scripts. and might have cut a bit too much line. Quote Link to comment https://forums.phpfreaks.com/topic/202592-php-missing-1-database-entry/#findComment-1061999 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.