Answer to Your Query

No table selected for search??
\n Please go back and specify it.\n"; echo "\n\n"; exit; } if (!$searchType ) { echo "

No search type indicated??
\n Please go back and specify it.

\n"; echo "\n\n"; exit; } if (!$searchTerm ) { echo "

No search term provided??
\n Please go back and specify it.

\n"; echo "\n\n"; exit; } //Connect to the database $db = mysql_pconnect("localhost", "shlin", "iesheepo"); if (!$db) { echo "Error: Could not connect to database. Please try again later."; exit; } //Echo the search strategy echo "

" . "You want to search the table " . $searchTable . " By " . $searchType . " With search term:" . $searchTerm . "
\n" . "At the moment, we can only list the entire customers table for you.

" ; //Select the "test" database mysql_select_db("test"); //Compose the query string $query = "select * from customers"; //Submit the query to MySQL and store the result in $result $result = mysql_query($query); //Determine the number of records in the result $num_records = mysql_num_rows($result); //Report the number of records found if ( $num_records > 0 ) echo "

Number of items found: " . $num_records . "

\n"; else echo "

No matching items found!!

\n"; if ($searchTable == "customers") { echo "

Customers!!

\n"; for ($i=0; $i <$num_records; $i++) { $row = mysql_fetch_array($result); echo "
\n"; echo "

Record " . ($i+1) . "
\n"; echo "cum: " . $row["cnum"] . "
\n"; echo "cname: " . $row["cname"] . "
\n"; echo "city: " . $row["city"] . "
\n"; echo "rating: ". $row["rating"] . "
\n"; echo "snum: ". $row["snum"] . "
\n"; echo "

\n"; } } ?>