1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP Warning: in_array() expects parameter 2 to be array, string given

Discussion in 'PHP' started by irdogg, Mar 26, 2020.

  1. #1
    i can't figure it out. my log keeps filling up
    /includes/functions.php on line 700

    line 700
    if ( $cam->$item == '' . $value . '' ) {
    Code (markup):

     
    irdogg, Mar 26, 2020 IP
  2. JEET

    JEET Notable Member

    Messages:
    3,825
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #2
    Is there an in_array() statement near this line? Little above, little below?
     
    JEET, Mar 26, 2020 IP
  3. irdogg

    irdogg Well-Known Member

    Messages:
    358
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    135
    #3
                                if ( $item == 'age' ) {
    
                                    if( in_array( $cam->age, $ages ) && $cam->gender == $gender ) {
    
                                        $count++;
    
                                        if ( $count >= $start && $count <= $end ) {
    
                                            echo $camhtml;
    
                                        }
    
                                    }
    
                                } elseif( $item == 'pop' ) {
    
                                    if ( $cam->num_users > $value ) {
    
                                        $count++;
    
                                        if ( $count >= $start && $count <= $end ) {
    
                                            echo $camhtml;
    
                                        }
    
                                    }
    
                                } elseif( $item == 'search' ) {
    
                                    if ( (QRY_HTML != NULL && QRY_HTML != '') &&
                                             (
                                                 in_array(QRY_HTML, $tags) ||
                                                (stripos($cam->display_name, QRY_HTML) !== false) ||
                                                (stripos($cam->room_subject, QRY_HTML) !== false) ||
                                                 (stripos($cam->username, QRY_HTML) !== false)
                                       
                                            )
                                        ) {
    
                                        $count++;
    
                                        if ( $count >= $start && $count <= $end ) {
    
                                            echo $camhtml;
    
                                        }
    
                                    }
    
                                } else {
    
                                    if ( $cam->$item == '' . $value . '' ) {
    
                                        $count++;
    
                                        if ( $count >= $start && $count <= $end ) {
    
                                            echo $camhtml;
    
                                        }
    
                                    }
    
                                }
    
                            }
                        }
    
                    echo '</div>';
    
                    $cams->close();
    Code (markup):
     
    irdogg, Mar 26, 2020 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #4
    Looks like $ages is wrong. Do a var_dump to see what it is
     
    sarahk, Mar 26, 2020 IP
  5. JEET

    JEET Notable Member

    Messages:
    3,825
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #5
    Like sarahk said, looks like $ages is not an array.
     
    JEET, Mar 26, 2020 IP
  6. irdogg

    irdogg Well-Known Member

    Messages:
    358
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    135
    #6
    thanx u... i made it to $age see if the errors go away
     
    irdogg, Mar 27, 2020 IP
    JEET likes this.