473,396 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SQL Select statement as a keyword search

adelemb
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?keyword=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.

Expand|Select|Wrap|Line Numbers
  1. var keyword = request.keyword;  
  2.  
  3. var sql = 'SELECT threadID, forumID, masterID, subject, message, datePosted FROM threads WHERE UPPER(message) LIKE UPPER('%' + keyword + '%')'  
  4.  
  5. var result = database.execute(sql);  
  6.  
  7. while(result) {     
  8.  
  9. nextCol(result[3])
  10. nextCol(result[5])
  11. nextCol(result[1])
  12. nextCol(result[2])
  13. nextRow()
  14.  
  15. result = database.nextRow(); } 
  16.  
  17. update(); 
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!!
Jul 9 '08 #1
1 3845
amitpatel66
2,367 Expert 2GB
Please print the query at run time in your screen and try to execute taht query in sql plus or TOAD and check if the data really exist.

Please post the run time query here for reference.
Jul 9 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: hokieghal99 | last post by:
Hi, I'd like to get user input from an html form into a mysql select statement. Here's where I'm stumped: $result = mysql_query("SELECT * FROM dept WHERE notes LIKE '%search-string%'",$db); ...
2
by: Omavlana | last post by:
Hi, I want to create a temporary table and store the logdetails from a.logdetail column. select a.logdetail , b.shmacno case when b.shmacno is null then select...
17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
2
by: Eitan | last post by:
Hello, I want a solutions for a compicateds sql select statments. The selects can use anything : views, stored procedures, analytic functions, etc... (not use materialized view, unless it is...
7
by: Steven Bethard | last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The patch is available at: http://bugs.python.org/1472459 and I've pasted the full text below. I've tried to be more explicit about...
3
by: Igor | last post by:
Is there possibility to use IF conditions inside SELECT statements? For example, can i write something like this: CREATE PROCEDURE ( @OPTION int, @KEYWORD nvarchar(40) ) AS BEGIN
25
by: CJM | last post by:
I'm getting a syntax error with a Select Case statement: Select Case CSng(rs.fields("Field1")) Case 0 Response.Write "Test1" Case Is < 0 <<< Syntax Error...
1
by: priyanka2203 | last post by:
Hi guys, I have a doubt regarding the CASE statement. It might sound silly, but me being new to DB2, it is kind of a genuine doubt. Try helping me with this.. When we use a case statement...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.