Jump to content

Basic PHP problem - help for a simple mind?


gem0670

Recommended Posts

I have a database of properties for a residential rentals website. 

 

I am trying to highlight specific properties as a Highlighted property.

What i would like to do is when there is yes is the 'highlighted property' field in the MySQL database some text is displayed above the property stating that it is featured and maybe a 3px blue border is added to the photo.

 

Can anyone help or direct me to a howto article.

 

 

As i am sure you have guessed I am very new to this and totally self taught (or un-taught may be a better description).

 

You can view the link to the page I am talking about below please add the w's (Do not want google to show this thread when my company name is searched for).

 

key-services.co.uk/Cyprus_Residential_Lettings.php

 

Thank you guys in advance for your help

 

Gemma.

 

 

Welcome!

 

If (as you say) there's a field called "highlight" in the database (maybe an ENUM with the values 'yes' and 'no') you can check when the property is viewed. Let's say the query to pull the property from the database is something like this:

$row=mysql_fetch_assoc(mysql_query("SELECT * FROM properties WHERE propertyid=".$id."));

 

We can check the highlight field like this:

if ($row['highlight']=='yes') {

 

Then as we build the HTML part of the page we can switch back to PHP and add any extras just by using the if() statement as shown above to add any extra text/styles.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.