Forum Moderators: coopster

Message Too Old, No Replies

Multiple Filters

How to filter with multiple column definitions via URL?

         

inveni0

10:34 pm on Jan 5, 2006 (gmt 0)

10+ Year Member



How would I change this:

$query_Show = sprintf("SELECT * FROM Rooms WHERE Room = '%s'", $colname_Show);

Currently, the URL send the data, so [myhomeurl.com...] would pull up the info for room 72 only.

BUT, I also have a column named "Poolside". How would I change the line above so that it would only show the room if it were poolside, using this URL as a filter:

[myhomeurl.com...]

inveni0

10:42 pm on Jan 5, 2006 (gmt 0)

10+ Year Member



Okay, I got that working, but how would I tell the script to display a "No results found" error if no rows match the query?

inveni0

1:37 pm on Jan 6, 2006 (gmt 0)

10+ Year Member



I'm still curious on how to accomplish this if anyone has any tips.

jatar_k

4:29 pm on Jan 6, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



after you do your query use mysql_num_rows [php.net] on the result of your query

if < 1 then display your "No results found"
else
carry on with processing the rows

inveni0

4:29 am on Jan 7, 2006 (gmt 0)

10+ Year Member



Okay, now I'm trying something similar. In a previous page, a form is used to submit a record ID, which loads a page displaying an update form for that record ID. If a wrong ID is entered, I need to know. I'm using:

if ($_POST['ReceiptID'] == NULL) {
echo "ERROR! Your information will not be saved because you've entered an invalid Receipt ID. Please press 'BACK' and try again.";
}

But this doesn't work. Where should I place it, or change it?

inveni0

4:43 am on Jan 7, 2006 (gmt 0)

10+ Year Member



Nevermind. I think I'm getting the hang of this!

jatar_k

4:53 am on Jan 7, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



;)