Jump to content


Photo

Help with Select statements


  • Please log in to reply
1 reply to this topic

#1 lwharding

lwharding
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 13 February 2006 - 11:48 AM

I am having a difficulty with a certain search query I am trying to execute within Dreamweaver.

I am attempting to create an number range search of a MySQL db; I have created a forms within a plain old html page that passes two fields ('from' and 'to') to the search page using 'GET' within a form. Then I have created a php page with a records set and the following SQL statement:

===============================================
SELECT hp.Name, hp.Age
FROM hp
WHERE hp.Age BETWEEN 'from' AND 'to'
ORDER BY hp.Age ASC

===============================================

I have entered in variables for the 'from' and 'to' fields to ensure that the above syntax is correct, which it is. However when executing the page it returns no results!

Any ideas on this are greatly appreciated as I am well and truely stumped!

#2 lwharding

lwharding
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 15 February 2006 - 03:49 PM

This has been resolved. Problem was I was using 'from' within search syntax. Doh!

[!--quoteo(post=345339:date=Feb 13 2006, 11:48 AM:name=Luke Harding)--][div class=\'quotetop\']QUOTE(Luke Harding @ Feb 13 2006, 11:48 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I am having a difficulty with a certain search query I am trying to execute within Dreamweaver.

I am attempting to create an number range search of a MySQL db; I have created a forms within a plain old html page that passes two fields ('from' and 'to') to the search page using 'GET' within a form. Then I have created a php page with a records set and the following SQL statement:

===============================================
SELECT hp.Name, hp.Age
FROM hp
WHERE hp.Age BETWEEN 'from' AND 'to'
ORDER BY hp.Age ASC

===============================================

I have entered in variables for the 'from' and 'to' fields to ensure that the above syntax is correct, which it is. However when executing the page it returns no results!

Any ideas on this are greatly appreciated as I am well and truely stumped!
[/quote]





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users