Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts

    php:If a field in a mysql table is blank then...

    hey.
    ok if worked out a script for displaying a few links acording to the contents of a field...in the field will be one word.... but what im trying to do now is an if statement.. so befor it prints the info it see is the field is blank...
    in english...
    if cell_name empty
    print somestuff
    else print some other stuff

    ok i know how to do if else statements in php... the thing i need help with is seing if the filed is empty or not..
    any ideas?
    cheers
    P

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    check the result set for null values
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    hey thanks spook.
    i did it not long after this post .. i just made the if see if it had the word "none" in the cell and set the default to none
    thanks tho man
    P

  • #4
    Regular Coder
    Join Date
    May 2002
    Location
    London, England
    Posts
    369
    Thanks
    0
    Thanked 0 Times in 0 Posts
    assume the value of a cell is set to $var:

    PHP Code:
    if(trim($var)=='')
    {
    echo 
    "Nothing found";
    }
    else
    {
    echo 
    $var;

    Jee
    Jeewhizz - MySQL Moderator
    http://www.sitehq.co.uk
    PHP and MySQL Hosting


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •