I need to check the array values which contains more than 400 values which is existing in the MySQL table where i should get result for all the values which I am passing even if it not exist in the column.
for example:
cont table
----------
Column1
---------
9xxxxxxxxx
91xxxxxxxx
92xxxxxxxx
my array contains 9xxxxxxxxx & 91xxxxxxxx. How can i iterate to get the column exist or not.
I tried with foreach and building query
$sql = 'SELECT cont WHERE num IN(';
foreach($jsonString as $val){
$sql = $sql . "'$val', ";
echo $val;
}
if(mysqli_query($con,$sql)){
echo "exist";
}else {
echo "error";
}
Is there any efficient way other than the above which is faster in time?
implode( ',', $jsonString )