Hi
This is my first post here and I have just started using php so please be kind LOL
I have tried to use the script below to do a search on the database
but it keeps spitting out (Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\web\1\search.php on line 23)
<?php
//connect to mysql
mysql_connect("localhost","root","");
//select which database you want to edit
mysql_select_db("rewards");
$search=$_POST["search"];
//get the mysql and store them in $result
$result = mysql_query("SELECT * FROM contacts WHERE message LIKE '%$search%'");
//grab all the content
while($r=mysql_fetch_array($result))
{
//the format is $variable = $r["nameofmysqlcolumn"];
$ID1=$r["ID1"];
$Firstname=$r["Firstname"];
$Surname=$r["Surname"];
$Cellphone=$r["Cellphone"];
$ID_number=$r["ID_number"];
$SalesCode=$r["SalesCode"];
$ShopID=$r["ShopID"];
//display the row
echo "$ID1 <br> $Firstname <br> $Surname <br> $Cellphone <br> $ID_number | $SalesCode <br> $ShopID <br>";
}
?>
I would really appreciate your help
Thanking you in advance