jamjam Posted July 31, 2010 Share Posted July 31, 2010 Hi I am developing a page that has this PHP code <?php echo $row_Programme['status']; ?> This code basically looks in a MySQL database table and echo’s the value of the status field. The value of the Status field will only ever have 5 possible values. I want to add an ‘if statement’ to the above code. So for example if the value returned by the code was “Coming Soon” I can add something like “Programme will be available soon” A second example would be if the value returned by the code was “Not Available” I can add something like “Sorry programme is not available” This properly really basic PHP. But am really new to this and will really appreciate the assistance. Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/209439-simple-if-statement-please-help/ Share on other sites More sharing options...
MatthewJ Posted July 31, 2010 Share Posted July 31, 2010 if($row_Programme['status'] == "Your Value") { echo "whatever message you want"; } elseif($row_Programme['status'] == "next value") { echo "next message"; }... etc. Link to comment https://forums.phpfreaks.com/topic/209439-simple-if-statement-please-help/#findComment-1093532 Share on other sites More sharing options...
jamjam Posted July 31, 2010 Author Share Posted July 31, 2010 Thanks Matthew It worked perfectly. Link to comment https://forums.phpfreaks.com/topic/209439-simple-if-statement-please-help/#findComment-1093539 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.