Blue Blue - 2 years ago 101
MySQL Question

PHP: Notice: Array to string conversion issue caused by LIKE

I have looked all over for a answer to this. But all the questions asked don't seem to answer my question.

I am trying to post from a html page to a php page.
But i am receiving this notice:

Notice: Array to string conversion ... line 41

In order to fix the issue i have stopped the page i am working on (index page) from posting to the next page, and post to the index page instead, so i can see what is going on.

Line 41

WHERE Delivery_Pcode.Pcode LIKE '%".$search."%'");

I am using the exactly the same query, part from the variable names in another page, and it works perfectly.

I am trying to retrieve the area name from the db, which matches the postal code which is inputted by the user in the search bar on the index page, there is nothing on the index page apart from the search bar.


$c_name= '';

$search= $_POST;

$select_pcode=mysqli_query($dbc,"SELECT Rest_Details.Resturant_ID, Rest_Details.City_name, Delivery_Pcode.Pcode
FROM Rest_Details INNER JOIN Delivery_Pcode
ON Delivery_Pcode.Restaurant_ID=Rest_Details.Resturant_ID

echo var_dump($select_pcode);

while($row_pcode= mysqli_fetch_array($select_pcode)){
$c_name = $row_pcode['City_name'];


I have never received this notice before, i am unaware how to deal with it or how to resolve the issue. Please advice

Answer Source

$search= $_POST;

That's the mistake, change it to

$search= $_POST['feed_me'];

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download