keefy Posted April 24, 2008 Share Posted April 24, 2008 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 Quote Link to comment Share on other sites More sharing options...
mrdamien Posted April 24, 2008 Share Posted April 24, 2008 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 Quote Link to comment Share on other sites More sharing options...
intodesi Posted April 24, 2008 Share Posted April 24, 2008 <? $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 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 Quote Link to comment Share on other sites More sharing options...
keefy Posted April 24, 2008 Author Share Posted April 24, 2008 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.... Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 24, 2008 Share Posted April 24, 2008 Please show us the code where you're having trouble. Please put the tags around the code. Ken Quote Link to comment Share on other sites More sharing options...
keefy Posted April 24, 2008 Author Share Posted April 24, 2008 Thanks members Ive got the right code now... <?php if ( $row [ 'propertyoption' ] == "R" ) { echo "Add your text here ..."; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.