MyBB Community Forums

Full Version: Need some help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm sorry If i'm posting in the wrong place.

I want to create a php image with conditions.
I want the php file to check the value of a field in one of my tables.
If the value of the field is 0 then display image1.png and if it is 1 then image2.png

I want this so I can put something like this
<img src="http://url/image.php" />

I'm sorry for my english.

Thank you very much.
You can do this quite easily using this code :

  $query = $db->simple_select("YourTableName", "YourFieldName", "YourConditionToSelectTheProperOne");
  if($query){
    $MyData = $db->fetch_array($query)
    print '<img src="http://url/image'.$MyData['YourFieldName']+1.'.png" />';
  }
I managed to get it working using another method but thanks anyway. Smile