yanks6rule Posted May 14, 2006 Share Posted May 14, 2006 I have a table that is populated from a MySQL database. The first column of this table is a checkbox that has the value remove[$guestID]. I am giving the user the opportunity to remove a guest they are no longer bringing or have to edit.If you have 3 guests with the following guestIDs 3, 6, 15 and you wanted to remove guest 15 you could check the last checkbox and I would want to check to see if any of the three checkboxes are marked and if they are I would remove the guest by matching the guestID to the value in the checkbox.Does this make sense or am I over thinking a simple problem. I can supply code that I have, I think I have to put this into an array but not sure how to check for the value being checked or not checked. Quote Link to comment Share on other sites More sharing options...
.josh Posted May 14, 2006 Share Posted May 14, 2006 [code]$sql = "delete from table WHERE guestid IN (";foreach ($remove as $id) { $sql.="'$id',";}$sql = substr_replace($sql,"",-1); $sql.=")";[/code]edited to take out a superfluous var that i left in from when i c/p the code Quote Link to comment Share on other sites More sharing options...
Barand Posted May 16, 2006 Share Posted May 16, 2006 I find it easier just to use a join()[code]$ids = join ("','" , $remove);$sql = "DELETE FROM tablename WHERE id IN ('$ids')";[/code] Quote Link to comment Share on other sites More sharing options...
.josh Posted May 16, 2006 Share Posted May 16, 2006 barand, have i ever mentioned that you are the shiz? [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] Quote Link to comment Share on other sites More sharing options...
Barand Posted May 16, 2006 Share Posted May 16, 2006 As it's outside my aged vocabulary, I'm assuming it's a compliment ;-) Quote Link to comment Share on other sites More sharing options...
.josh Posted May 17, 2006 Share Posted May 17, 2006 yes, it's shortened form of shiznit, as in, you are the shiznit! Which is an alternate way of saying sh*t. As in, you are the sh*t!, or, you are the man! and come on, you can't be THAT (much) old(er).. Judging by posting styles on these forums, I'd say I'm probably one of the older people around here... Quote Link to comment 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.