Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 General help me questions
 Assistance Selecting Records from dB
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jdkerr
Starting Member

Canada
43 Posts

Posted - December 29 2006 :  16:57:02  Show Profile  Visit jdkerr's Homepage  Reply with Quote
I have a custom routine on my system which show a list of all products for sale in a simple drop-down box. It works fine, and I use the following SQL statement:

sql1="SELECT * FROM products ORDER by pother3"

What I would like to do, is to NOT display in the list products where the 'hide' dB field is blank. I cannot recall the SQL syntax to exclude certain results when doing the selection.

Ideas???

Thanks..John

devshb
Senior Member

United Kingdom
1904 Posts

Posted - December 29 2006 :  18:14:05  Show Profile  Visit devshb's Homepage  Reply with Quote
try:

select * from products where hide is not null order by pother3

or if you want to show products which are normally hidden, use:

select * from products where hide=1 order by pother3

Simon Barnaby
Developer
[email protected]
www.BigYellowZone.com
Web Design, Online Marketing and VPASP addons

Edited by - devshb on December 29 2006 18:18:12
Go to Top of Page

jdkerr
Starting Member

Canada
43 Posts

Posted - December 30 2006 :  04:08:37  Show Profile  Visit jdkerr's Homepage  Reply with Quote
Simon,

Thanks for the note..

I tried the first option (select * from products where hide is not null order by pother3) but the results appeared to be the same as before (the hidden products were still showing).

I tried the second option (select * from products where hide=1 order by pother3) and no products showed - which is strange as I know I have some items that are hidden.

I gave it one last try, and ammended the last option to: "select * from products where hide=0 order by pother3" and now it works perfect, filtering out the hidden products.

Thanks...
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00