I have an array that contains strings
e.g array('14183f6c-9bf5', '074306fb-6eaf')
I want to convert this into a format readable for an mysql query with an IN statement but I keep getting issues as its a string..
Essentially get this to be formatted as such in my sql query - I am using implode but to no avail.. any ideas
Guid IN ("14183f6c-9bf5", "074306fb-6eaf")
$Guids = array('14183f6c-9bf5', '074306fb-6eaf');
$csv = implode('",', $Guids);
Try something like this
$whereIn = implode('","', $array);
$sql = 'SELECT * FROM table WHERE col IN ("'.$whereIn.'")';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With