Jump to content

[SOLVED] If Statement


keefy

Recommended Posts

Im sorry but ive searched and could not find, i know this will be easy for most people but im new and trying my best to understand.

 

My simple need is:-

 

I want to be able to show some text "some example text" on my website only if the feature from table pp_goods is = to Y.

 

I have a table called pp_goods in side that table, if i browse i have ID, goodsname, Feature etc

in feature it stores only Y or N

 

Please help me on my way...

 

Thanks

Link to comment
Share on other sites

This isn't an "if statement" problem. We don't write whole scripts for you.

 

Here's some pseudo-code to get you started:

 

-Connect to DB server

-Select database

-Query db: Select row from pp_goods

-If pp_goods.feature == "y"

--Then echo "some example text"

--Else nothing

-Disconnect from DB server

Link to comment
Share on other sites

<?
$id = an id number goes here

require 'dbconf.php'; <---- Your Database Configuration File

$sql = mysql_query("SELECT * FROM pp_goods "." WHERE ID='$id'");

if (features != yes) {
echo "some example text"
}
?>

 

maybe :P

 

sorry, everyone helps me all the time, just figured I would attempt to be of some help in return, and this looks like something I could get right :P

Link to comment
Share on other sites

It does not work intodesi

 

maybe ive asked wrong..

 

1st of all the database is already open, i have a script which is actually showing properties, i used pp_goods and features as an example.. so will give the correct tables then it might make things a little easier, sorry i should have just done that in the first place.

 

I have a website and it shows rentals and sales... the script was bought.

however i need it to display some text "Long term rentals available" when showing a rental...

In the database i have a table called pm_properties below is what is in the config.php

$property_table          = "pm_properties";

 

If i go into phpmyadmin i have a table called pm_properties in that table i have a field called propertyoption which holds either R or S depending on sale or rental.

 

I would like:- If propertyoption = R then put "Long term rentals available" on the screen.

 

Sorry for been so confusing....

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.