Writing Mysql Queries

admin

Administrator
Staff member
Hope someone can help me out here!
I'm new to all this mysql and php stuff, and have a large database of information to access.
I can write a query to access All from TABLE X WHERE Y="a specific value" and Z="another option", but how can I write the query, or php script so that if the Y input showed no results, that the result would show ALL rows that matched only the Z result?
For example if Y values are town names, and Z values were Pubs, how would I have to script it so Y could = any or all towns, if that input value = <!-- m --><a class="postlink" href="http://www.phpbuilder.com/board/archive/index.php/">http://www.phpbuilder.com/board/archive/index.php/</a><!-- m -->"All towns", when no database entry has "All towns" as its value?

Also, if there are 100 results, how do I script it to show the first 20 ( I know; LIMIT 20) but then give you a button to list the next 20 results, and so on with a display at the top saying as they often do " Showing results 1 to 20 of 100" etc

Please Help!
 
Back
Top