I am developing a script that takes input from a form and outputs the results to a page, the results are based on the choices made on the form.
The form has 4 input elements, what I want to do is add some code to my script so that if no selection is made in any of the input elements the query will become:
In other words should a selection not be made in any selection choice then all the table data will be output.Code:#Prepare query prior to execution if (!($query = $dbh->prepare("SELECT * FROM databasename "))) { #output error message if preparation fails &outputErr("couldn't prepare statement".$dbh->errstr); }![]()
How would I do this, I have an idea it will be an if statement, how will this be done?
The query if all choices are selected is:
Code:#Prepare query prior to execution if (!($query = $dbh->prepare("SELECT * FROM databasename WHERE choice = '$choice1' AND Person = '$choice2' AND Choice = '$choice3' AND Row = '$textinput' "))) { #output error message if preparation fails &outputErr("couldn't prepare statement".$dbh->errstr); }


LinkBack URL
About LinkBacks




Reply With Quote

Bookmarks