May 22, 201016 yr Hi guysm Basicly, Im trying to retrieve records from the database, only issue is, it misses out the first record and includes the rest... Row 1, Will not display on the website Row, 2, 3, 4 and so on will.. what am i doing wrong... //GET ALLOWED IPS $allowed_query = "SELECT * FROM mi5_allowed"; $allowed_run = mysql_query($allowed_query); $allowed_row = mysql_fetch_assoc($allowed_run); <?php while(mysql_fetch_assoc($allowed_run)) { ?> <form action="allowedips.php?action=delete" method="post"> <table class="ipslist_table2"> <tr> <td class="ipslist_td2"><?php echo $allowed_row['name']; ?></td> <td class="ipslist_td2"><?php echo $allowed_row['ip']; ?></td> <td class="ipslist_td2"><?php echo $allowed_row['date']; ?> <input type="image" src="theme/images/cross.png" border="0" alt="Delete"></td> </tr> </table> <input name="ip" value="<?php echo $allowed_row['ip']; ?>" type="hidden" size="15" /> </form> <?php } ?>
May 22, 201016 yr remove this line before the while loop $allowed_row = mysql_fetch_assoc($allowed_run);
May 22, 201016 yr Author remove this line before the while loop $allowed_row = mysql_fetch_assoc($allowed_run); That doesnt solve it, Now there is no querys showing..
May 22, 201016 yr Well it should Your code now looks like this yeah? //GET ALLOWED IPS $allowed_query = "SELECT * FROM mi5_allowed"; $allowed_run = mysql_query($allowed_query); while(mysql_fetch_assoc($allowed_run)) { ?> <form action="allowedips.php?action=delete" method="post"> <table class="ipslist_table2"> <tr> <td class="ipslist_td2"><?php echo $allowed_row['name']; ?></td> <td class="ipslist_td2"><?php echo $allowed_row['ip']; ?></td> <td class="ipslist_td2"><?php echo $allowed_row['date']; ?> <input type="image" src="theme/images/cross.png" border="0" alt="Delete"></td> </tr> </table> <input name="ip" value="<?php echo $allowed_row['ip']; ?>" type="hidden" size="15" /> </form> <?php } ?> Note that you also had a <?php before the while but were actually in php already, so that would have caused a parse error Did you only paste certain parts of your code? or miss bits?
May 22, 201016 yr Author Well it should Your code now looks like this yeah? //GET ALLOWED IPS $allowed_query = "SELECT * FROM mi5_allowed"; $allowed_run = mysql_query($allowed_query); while(mysql_fetch_assoc($allowed_run)) { ?> <form action="allowedips.php?action=delete" method="post"> <table class="ipslist_table2"> <tr> <td class="ipslist_td2"><?php echo $allowed_row['name']; ?></td> <td class="ipslist_td2"><?php echo $allowed_row['ip']; ?></td> <td class="ipslist_td2"><?php echo $allowed_row['date']; ?> <input type="image" src="theme/images/cross.png" border="0" alt="Delete"></td> </tr> </table> <input name="ip" value="<?php echo $allowed_row['ip']; ?>" type="hidden" size="15" /> </form> <?php } ?> Note that you also had a <?php before the while but were actually in php already, so that would have caused a parse error Did you only paste certain parts of your code? or miss bits? No mate, I was only posting parts of the code the top peace is in <?php tags, i just didnt paste them into the post
May 22, 201016 yr ah you needed to add $allowed_row= to the while loop and remove the line I said to remove The simple fact of the matter is it shouldn't have shown any code if the $allowed_row was not there, so you must have had that there already when you were testing with all but the first row showing
Create an account or sign in to comment