Heya
,
What ill show you now is just a simple tip that you should be using in your websites if you are already not!
No the old fasioned way of selecting ids is to do a foreach loops like so
This causes multiple queries but the best way to do this with one query is by using the mysql WHERE IN Clause like below
No the mysql resource that is returned will have them rows in it and only taken 1 query
Hope you all like this lil tip
What ill show you now is just a simple tip that you should be using in your websites if you are already not!
No the old fasioned way of selecting ids is to do a foreach loops like so
Code:
foreach($ids as $id){
//Delete $id or Select $id here
}
This causes multiple queries but the best way to do this with one query is by using the mysql WHERE IN Clause like below
PHP:
$ids = array(22,47,121); // this can be from $_POST
$query = "SELECT title FROM mytable WHERE id IN (".implode(",",$ids).")";
mysql_query($query);
No the mysql resource that is returned will have them rows in it and only taken 1 query
Hope you all like this lil tip