Results 1 to 4 of 4

Thread: [RESOLVED] Really simple IF

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    67

    Resolved [RESOLVED] Really simple IF

    I'm going crazy here. I know this is really basic but...
    I wan't to check if a SQL result contains as string.

    Code:
    IF $result contains $_SESSION['name']
    {
    Do **** here
    }
    Thanks
    FORZA ROSSONERI! CAMPIONI!!!

  2. #2
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Really simple IF

    If statements are structerd like this.

    php Code:
    1. if(condition)
    2. {
    3.     // True
    4. }
    5. else
    6.     // False
    7. }

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Really simple IF

    If $result is a string:
    PHP Code:
    if (strpos($result$_SESSION['name']) >= 0) {
      
    // ...

    If $result is an array:
    PHP Code:
    if (in_array($_SESSION['name'], $result)) {
      
    // ...

    Last edited by penagate; May 4th, 2007 at 09:14 PM.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    67

    Re: Really simple IF

    Thanks penagate.
    FORZA ROSSONERI! CAMPIONI!!!

Posting Permissions

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



Click Here to Expand Forum to Full Width