Current location: Hot Scripts Forums » Programming Languages » PHP » If DB Entry equals This then Display That


If DB Entry equals This then Display That

Reply
  #1 (permalink)  
Old 02-12-04, 04:48 AM
UKSwift UKSwift is offline
Newbie Coder
 
Join Date: Jul 2003
Location: Doncaster, UK
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
If DB Entry equals This then Display That

Hi,

I'm wondering if anyone can give me a kick start on how i can do this. I am working on a Real Estate script for post nuke. I am wanting to write a block that will randomly display a property that is featured.

In the table that the property is stored a field will be filled in with either:

Yes - for being featured
No - for not being featured

I am wanting to randomly display any property that has a Yes in the featured field of the database.

Any help on this matter will be greatly appreciated.

Regards

Tim
__________________
Roar!
Reply With Quote
  #2 (permalink)  
Old 02-12-04, 04:13 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
$query = SELECT fields FROM table_name WHERE field_name='Yes" ORDER BY rand()";

Replace "fields" with "*", id, or whatever fields you want to retrieve; replace "table_name" with the name of your table; replace "field_name" with the field that holds the "Yes" value.

See if that works.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Database display egcreative PHP 2 11-02-03 02:16 AM
If date is less than today do not display jimthepict ASP 5 10-19-03 10:43 PM
call, array and display? irfaan PHP 5 08-09-03 05:41 PM
Manipulating arrays for display in HTML madsurfer007 PHP 3 08-07-03 08:26 PM
display data sasi ASP 6 08-06-03 05:52 PM


All times are GMT -5. The time now is 08:47 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.