Hi,
I'm trying to make a SQL statement work and am getting quite mixed up with it, I hope someone can help!
I have a form with a textbox named "keyword". I want the user to enter a keyword and then a search occurs through the table to find that keyword. The results should then be displayed on the next page. I have the keyword parameter appearing in the page URL e.g. www.xxxxxx.com/page.htm?keywor d=help
My problem (I think) is the way I am calling the keyword variable in the SQL statement? I have tried countless variations but I either get red error messages or a blank page.
Can anyone help? I'm sure it's something obvious but am pulling my hair out trying to fix this!! (and baldness would really not suit me)
Let me know if more info is needed, thank you!!
I'm trying to make a SQL statement work and am getting quite mixed up with it, I hope someone can help!
I have a form with a textbox named "keyword". I want the user to enter a keyword and then a search occurs through the table to find that keyword. The results should then be displayed on the next page. I have the keyword parameter appearing in the page URL e.g. www.xxxxxx.com/page.htm?keywor d=help
My problem (I think) is the way I am calling the keyword variable in the SQL statement? I have tried countless variations but I either get red error messages or a blank page.
Code:
var keyword = request.keyword;
var sql = 'SELECT threadID, forumID, masterID, subject, message, datePosted FROM threads WHERE UPPER(message) LIKE UPPER('%' + keyword + '%')'
var result = database.execute(sql);
while(result) {
nextCol(result[3])
nextCol(result[5])
nextCol(result[1])
nextCol(result[2])
nextRow()
result = database.nextRow(); }
update();
Let me know if more info is needed, thank you!!
Comment