Hi all,
We have an Oracle database and my problem is with SQL, apologies if this is posted in the wrong forum.
I have this SQL statement that all works fine:
My problem is when there are no results to display, I want a sentence to appear saying "No results found" - the ELSE bit of the statement above.
Can anyone tell me why this doesn't work?
I know it is probably something obvious to all you clever people!
Thanks in advance!!
We have an Oracle database and my problem is with SQL, apologies if this is posted in the wrong forum.
I have this SQL statement that all works fine:
Code:
var newConn = new openConnection();
if(request.searchBox)
{
var searchBox = request.searchBox;
var keywords = searchBox.split(' ')
var sql = 'SELECT forumID, masterID, subject, message, datePosted FROM THREADS WHERE approved=1'
for(var i=0; i<keywords.length; i++)
{
sql += ' AND UPPER(subject) LIKE UPPER(\'%' + keywords[i] + '%\')'
sql += ' OR UPPER(message) LIKE UPPER(\'%' + keywords[i] + '%\')'
}
sql += ' ORDER BY datePosted DESC;';
}
else {
document.write("No results found");
}
Can anyone tell me why this doesn't work?
I know it is probably something obvious to all you clever people!
Thanks in advance!!
Comment