i can only use this code to search for firstname, i want it to search the whole databse table how do i do that $search=$_POST["search"]; $result = mysql_query("SELECT * FROM contacts WHERE firstname LIKE '%$search%'"); while($row=mysql_fetch_array($result)) { $firstname=$row["firstname"]; $lastname=$row["lastname"]; $email=$row["email"]; $phone=$row["phone"]; echo "$firstname <br> $lastname <br> $email <br> $phone <br>";
Use this for you're mysql query. It should work. $result = mysql_query("SELECT * FROM contacts WHERE firstname LIKE '%$search%' OR lastname LIKE '%$search%' OR email LIKE '%$search%' OR phone LIKE '%$search%'");
you are are star my hat off jleville that works you can believe have been googling all day can i ask you for one more favour pls from my code you can see that the data would come out in a table like format like this firstname, lastname, phone, email how do i do this
mysql is quite easy once you get a hang of getting all the data needed for what you specifically want. MYSQL is extremely flexible!
babyphp I already responded to your other thread regarding adding this data to a table. Take a look: http://forums.digitalpoint.com/showthread.php?t=798771