Hi - hopefully this is an easy query for any experts out there!
I have a text entry on a form where someone enters a surname they want to search for and when they press the submit button the page should display the results. The page is linked to a table in a phpmyadmin database with following headings - MemberID, Title, FName, LName. The action element of the form is to go to a php page with the following code:
The include file has the SQL which I am struggling with. I have played around with a few variations - do I need to use $_POST somewhere? I need it to search the database for whatever surname is entered in the form and then return the results - can anyone help? Thanks
I'm not sure what you're having trouble with. I've also noticed that you're 'for' loops aren't going to reitterate because they stop when $i and $j equal 1. Have a look at this code, maybe it'll help you.
// Connect to MySQL Server and select databse.
// Grab the input from the HTML form
$lastname = $_POST["lastname"];
$query = "SELECT * FROM people"; // People would be your table containing all this information.
$result = mysql_query($query); // Query the database