Search function using PHP

EncusaLiailla

New Member
I have devised code for a simple search function which allow the user to search for a forename and display info in the database about the search; \[code\]<html> <head> <title>Search for a patient</title> </head> <body> <form name="search" method="post" action="search.php"> Search for: <input type="text" name="search" /> <input type="submit" name="submit" value="http://stackoverflow.com/questions/15912180/submit"/> </form> </body></html>\[/code\]Search.phpEDIT\[code\] <?php$conn = mysqli_connect("localhost","root","") or die ("No connection");mysqli_select_db($conn, "a&e") or die('Could not select database.');$search = mysql_real_escape_string(trim($_POST['search']));$find_firstname = mysqli_query($conn, "SELECT Forname FROM 'Patient' WHERE forname LIKE'%$search%'");while($row = $find_firstname->fetch_object()){{ $forname = $row['forname']; echo "$forname<br />"; } }?>\[/code\]These are the errors I am getting: ERRORS: \[code\]Fatal error: Call to a member function fetch_object() on a non-object in search.php on line 10\[/code\]
 
Top