gday guys and gals im having trouble with some code here i cant see ne thing wrong with it but maybe u’s can help me out.
Now it should just show all the results if i don’t put any search parameters in but it just keeps coming up with the error message. “There are no matching…”
thanks coolman
[php]
Comic Collectables - Search ResultsComic Collectables - Search Results
<? //Check that the form has been submitted if ($POST) { // Store form data in varibles $form_series_name = $_POST['series_name']; $form_comic_issue = $_POST['comic_issue']; $form_comic_condition = $_POST['comic_condition']; //trim the data field up $form_comic_issue = trim($form_comic_issue); //open a link to the data base $link = mysqli_connect('localhost', 'user', 'password', 'database'); //define query $query = " SELECT comics.comic_id series.series_name comics.comics_issue comics.comic_condition comics.comic_price FROM series, comics WHERE series.comic_id = comics.series_id"; //restrictions for the search if any if ($form_series_name !="") { $query .= "AND series.series_name = '$form_series_name' "; } if ($form_comic_issue !="") { $query .= "AND comics.comic_issue = '$form_comic_issue' "; } if ($form_comic_condition !="") { $query .= "AND comics.comic_condition = '$form_comic_condition' "; } // Save the results $result = mysqli_query($link, $query); //set the number of rows $number_of_rows = mysqli_num_rows($result); //close the link mysqli_close($link); } //if no records are retrieved if ($number_of_rows == 0) { echo <<<ENDThere are no matching records in the database. Use the Back button on your Web browser to return to the previous page and try again.
END; } else { //display the coloum headings echo <<<ENDSearch results are presented below
ID Number | Series | Issue | Condition | Price |
---|---|---|---|---|
$comic_id | $series_name | $comic_issue | $comic_condition | $comic_price |
[/php]
**Mod edit: Added PHP tags for easier readability.