You can keep adding as many ANDs as you like:
Code:
$sql = "select * from profiles where sex = '$sex2' and agegrp = '$agegrp2' and interestedin= '$interestedin2'";
- as I say you can have as many ANDs as needed.
To display the other records on another page you'd simply create a link to a page, and on that page execute the same SQL query but omit the limit part. A neater way is to call the same page, but pass in a parameter to say "I want to see all records, not just the first 5".
Your page is called data_out.php3 I think? In that case you might make the "show all records" link point to "data_out.php3?show=all" or something like that. Then in your code, where you currently have
Code:
elseif (isset($submit)):
$sql = "select * from profiles where sex = '$sex2' and agegrp = '$agegrp2' limit 5";
else:
(with any extra AND consitions you might need), rewrite it slightly to be:
Code:
elseif (isset($submit)):
$sql = "select * from profiles where sex = '$sex2' and agegrp = '$agegrp2'";
if ($show != "all"):
$sql .= " limit 5";
endif;
else:
In that code, you create the start of your SQL statement. Then you check to see if the page was called with "show=all" in the querystring. If it wasn't you only want to show five records, so you add the "limit 5" onto the SQL statement (note the ".=" will append it to the string, where just "=" would overwrite it). If "show=all" was present you want to show all records, so you don't bother adding the limit on.
Obviously that's just an example of how it could be done, you should feel free to change it to however works best for you.
Hope you can understand that poor explanation
.
Bookmarks