Jump to content

See if item in table has attribute in array


franzwarning

Recommended Posts

One way would be to select * and in the while loop use if(in_array($row[thesurname],$the_array_of_names)){do something;}

 

I use this method all the time. It is very efficient and does not take long at all, +1 imo.

 

No. Very no.

 

Stop being a negative nancy.

Depends on the size of the array and where it's coming from. But in general you can

WHERE field IN ("value 1", "value 2", "value 3")

or

WHERE (field = "value1" OR field = "value 2" OR field = "value 3")

 

mm Double quotes work for string values in MySQL?  ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.