checking entered new resturant name : LUSENET : WebdesignII : One Thread

I have two queries, each of which produces one of the two results I want, but not both :-(

Does anyone have an idea how to combine them?

Here they are:

# this makes it possible to add a new resturant name, but dosen't catch it when an exact match is entered!

set check [ns_db 0or1row $db "select rest_name from rest where rest_name ='$rest_name'"]

# this one catches exact name matches and redirects the user to the Review page

# but adding new resturants is not possible

set check [database_to_tcl_string $db "select rest_name from rest where rest_name ='$rest_name'"]


-- Tony (, April 21, 2002


you are selecting NAME with NAME, that makes no sense. use the first (corrected to selcting res_is) and add - set_variables_after_query - string compare on $res_id


-- Lasse (, April 21, 2002.

Thanks, but now I have another problem......that procedure "set_variables_after_query" expects you to also use "set selection"

And that apparently only accepts "select" as an argument.

Here's what I've done:

set check [ns_db 0or1row $db "select rest_id from rest where rest_name ='$rest_name'"]

set selection [ns_db select $db $check]


if { [string compare $rest_id $check] == 0} { ns_returnredirect "rest_rate_form.tcl?rest_name=$rest_name&rest_id=$rest_id" exit } else {..........

the ERROR message reads in part like this:

Database operation "select" failed (exception NSDB, "Query was not a statement returning rows.")

while executing "ns_db select $db $check"

invoked from within "set selection [ns_db select $db $check]

Still missing some small part I think..... :0)

-- Tony (, April 21, 2002.

iwant a new resturant name

-- haytham mezher (, December 24, 2002.

Moderation questions? read the FAQ