Jump to content

Returning false with in_array


Go to solution Solved by floridaflatlander,

Recommended Posts

In the elseif below if the $group_num is in the $dont_print I don't want add the info, what am I doing wrong

 $dont_print = array(0, 12);

 foreach ($group_array as $key => $group_num) {


  if (!$add_on_sql) {$add_on_sql = 'WHERE id_group = '.$group_num.'';}
  elseif (in_array($group_num, $dont_print, FALSE)) {$add_on_sql .= ' OR id_group = '.$group_num.'';}


 }

Thanks

Link to comment
https://forums.phpfreaks.com/topic/280502-returning-false-with-in_array/
Share on other sites

  • Solution

Okay I printed $q and found the problem, 12 the number I didn't want was first up in the loop and address in the if() not the elseif()

 

Sorry about that Muddy_Funster and thanks

Edited by floridaflatlander
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.