Database, "1" or "YES" as the show

Discussion in 'PHP' started by johonwayni, Oct 27, 2011.

  1. #1
    How can i do?

    Database, "1" or "YES" as the show.


    databaseden.jpg

    Thank you.
     
    johonwayni, Oct 27, 2011 IP
  2. HuggyEssex

    HuggyEssex Member

    Messages:
    297
    Likes Received:
    4
    Best Answers:
    2
    Trophy Points:
    45
    #2
    When your displaying the result from the database you can write a simple function like this.

    
    function yesno($value) {
    if($value>0) {
    $return = 'Yes';
    }else{
    $return = 'No';
    }
    return $return;
    }
    
    PHP:
    Then when you want to display the result write this,
    
    echo yesno($value_here);
    
    PHP:
    I presume that you are getting the information from a database, if you don't understand the code please post your code here and I'll show you how to implement it.

    Glen
     
    HuggyEssex, Oct 27, 2011 IP