PDA

View Full Version : SQL Newbie WHERE question


kiwipenguin
07-12-2003, 10:31 PM
Hi there

I'm writing a short Perl script to pull some data out of an Access database. It works fine, however I recall seeing you could us a ? in the WHERE statement to pass a variable to the script thru the browser. Is the right?

My current statement is: SELECT * FROM Table1

I've got : SELECT * FROM Table1 WHERE category=?

but this fails. Can someone point me in the right direction?

gish
07-12-2003, 10:39 PM
ok

the '?' is a querysting parameter to pass variables page by page via the browser; for example:

http://www.test.com/page1.asp?category=1&display=2


var nCat = "" + Request.QueryString("category");

//in the above example the value of nCat is 1.

'SELECT * FROM Table1 WHERE category=' + nCat;