Welcome visitor
* Login
* Register
It is currently July 20th, 2019, 5:08 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Server Side » PHP



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  help on specific kind of selecting from mysql table
PostPosted: February 18th, 2009, 7:53 am 
User avatar

Posts: 81
Hi guys,

basically what im doing is a menu on an html form that retrieves the info, like total prices and that stuff, so i know how to retrieve the info for an specific product, kind of something like this
$row=mysql_query("SELECT * FROM products WHERE specials='$firstOpt'");

but if the first option is blank i would like to show all the rows, how can i do it? any idea?

Thanks.


Top
 Profile  
 
  Re: help on specific kind of selecting from mysql table
PostPosted: February 18th, 2009, 7:34 pm 
User avatar

Posts: 112
$row=mysql_query("SELECT * FROM products WHERE specials LIKE '%' ORDER BY specials ASC ");

where like is used to compare strings and the% symbol is a wildcard like the '*' but the percentage is for strings.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Server Side » PHP


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron