The problem is that explode
returns an array containing the strings in between the character(s) you used as a delimiter (,
in your case), not a string.
PHP is getting mad because it doesn't know how to convert your array to a string automatically. So, you will need to convert it yourself. The options are:
You want to select the row where
item
is equal to the nth element in the array,$data_from_array_column
. If this is the case, you need to insert the following line of code after your explode:$data_from_array_column = $data_from_array_column[0];
If you want to select where it matches any of the elements in the
$data_from_array_column
array, it will get more complicated. You would need to add this line after the explode:$data_from_array_column = implode("' OR item='",$data_from_array_column);
and change your query on the next line to:
$getdata = mysql_query("SELECT * FROM info WHERE item='$data_from_array_column'");
This will create a MySQL query that looks some thing like this:
SELECT * FROM info WHERE item='foo' OR item='bar' OR item='bla'