SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question with if

    i have an if thats not failing if the condition isn't true:
    PHP Code:
    // Check the display email option.
    if ($row[dis_email]==1){
    print 
    "<td width=\"8%\" bgcolor=\"#555555\"><a href=\"mailto:$user_row[email]\"><img src=\"/images/icons/email.gif\" border=\"0\"></a></td>\n";
    } else {
    print 
    "<td width=\"8%\" height=\"25\">&nbsp;</td>"; } 
    i tried using = and ==
    neither work.
    i want it so if $row[dis_email]=1, display email. or if it =0, not to.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try

    if ($row[dis_email]== "1") {

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    and make sure that your variable is 1 or 0, and not on or off...

  4. #4
    SitePoint Addict kunal's Avatar
    Join Date
    Oct 2000
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by dijksma
    and make sure that your variable is 1 or 0, and not on or off...
    i dunno...

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    Wolverhampton, UK
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $row["dis_email"] ???

    beachball

  6. #6
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    DOH! forgot that i declared dis_email as a varchar, and not an int, so i'd need the double quotes around the value.
    workin great. thanks!
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  7. #7
    SitePoint Addict kunal's Avatar
    Join Date
    Oct 2000
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Defender1
    DOH! forgot that i declared dis_email as a varchar, and not an int, so i'd need the double quotes around the value.
    workin great. thanks!
    :P
    i dunno...


Bookmarks

Posting Permissions

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