Jump to content

Help with Select statements


Recommended Posts

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:

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

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!
Link to comment
Share on other sites

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) [snapback]345339[/snapback][/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:

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

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.