Grego Posted June 17, 2007 Share Posted June 17, 2007 Basically, I have a table in my database with two entries. One of the columns in the table is an "ID" column so I can access particular records. The problem is that the two entries have IDs of "19" and "20". I can't set them to 0 and 1. They are fixed at those numbers. Now my real problem comes when trying to delete them. I have the entries displayed in a list with a checkbox at the right. The checkboxes are "name='ko19'" and "name='ko20'" respectively. Now when I get to the next page, I want to delete the selected ones. I tried to pull everything out of my table, use "mysql_num_rows" to select the number of records then make a for statement from 0 to the result of the num_rows. In the for statement is: $strlk="ko" . $i; if (isset($_POST[$strlk])) die("Message Found"); The problem of course is that there are only two rows in my table. So it never gets up to 19 or 20. My question to you is pretty much how I can create a for statement from 0 to 20 (though 20 will change over time to higher numbers). Here is my whole code: $count=mysql_num_rows(mysql_query("SELECT * FROM pms")); for($i=0;$i<=$count;$i++) { $strlk="ko" . $i; if (isset($_POST[$strlk])) die("boo"); //mysql_query("DELETE FROM pms WHERE qID=$i"); } Forgot to mention this is PHP, but I'm looking for a mySQL function, I think. Move if appropriate. Quote Link to comment https://forums.phpfreaks.com/topic/55938-selecting-data-tricky-to-explain-in-one-sentance/ Share on other sites More sharing options...
fenway Posted June 17, 2007 Share Posted June 17, 2007 I don't know what you're trying to do... or why you're querying the table at all. Quote Link to comment https://forums.phpfreaks.com/topic/55938-selecting-data-tricky-to-explain-in-one-sentance/#findComment-276335 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.