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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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