In the project that I am creating, I have a mysql column that is an array of different pieces of data from the database. These pieces of data have info that I want to display. In order to separate these items in the array I used,
$get_query = mysql_query('Select array FROM data');
while($dataRow = mysql_fetch_assoc($getfrnd_query)) {
$array = $dataRow['array'];
if($array != "") {
$data_from_array_column = explode("," $array);
$getdata = mysql_query("SELECT * FROM info WHERE item = $data_from_array_column");
//Then I used a mysql_fetch_assoc to get data based on the item.
}
}
When I run this code, I get an error "Array to string conversion on the line with $getdata". Is there any way to get this to work?
Thank you.
$data_from_array_column
come into play? – Fred -ii- Apr 9 '14 at 0:07$data_from_array_column
is an array, but you are using it as a string. Can you provide the code that generates it, or addvar_dump($data_from_array_column);
at the beginning of your code and post it so we can see it. – SuperScript Apr 9 '14 at 0:12$data_from_array_column
would shed a bit more light on the subject. ;-) Plus, "IF" anything, that should be wrapped in quotes.WHERE item = '$data_from_array_column'");
– Fred -ii- Apr 9 '14 at 0:15