SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem using IN with if statement.

    I am trying to use the code below, but I seem to be getting white out when used, it seems right but cant work out why its not working.

    Code:
    <? if ($q['IdCat_Hot'] IN ("6,7")){
    	
    } else {
    	
    } ?>

  2. #2
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,389
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    Morning multichild,

    You can use in_array for this:
    PHP Code:
    if (in_array($q['IdCat_Hot'], array(67))) { 

  3. #3
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Morning fretburner,

    thanks that works perfectly.


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
  •