...

View Full Version : Simple PHP question



briintex1
07-14-2007, 03:47 AM
Can someone tell me what is wrong with this php statement?


$query3 = "SELECT `Premium` AS 'premium' FROM `Premiums` where 'ID' > 3 && > 5"


This is the beginning of the code. I am making a listbox where someone clicks something in it...it displays the corresponding information in another area.

StupidRalph
07-14-2007, 04:06 AM
where 'ID' > 3 && > 5"



Whats this mean?

briintex1
07-14-2007, 04:19 AM
Basically what I am trying to do is display everything where ID is between two numbers...if I put 5 and 7 in the numbers it should display only 6.

If I have this

$query3 = "SELECT `Premium` AS 'premium' FROM `Premiums` where 'ID' > 5 && 'ID' > 7";


my list box shows everything and and the text box shows undefined.

If I have


$query3 = "SELECT `Premium` AS 'premium' FROM `Premiums`";


Then it displays everything just fine.

I am lost on the first snippet of code.

StupidRalph
07-14-2007, 04:25 AM
Well you do realize that you have single quotes on 'ID' and not backticks `ID`. Additionally, you can use the BETWEEN ...AND operators.


SELECT column_name FROM table_name
WHERE column_name
BETWEEN value1 AND value2



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum