add an and

hello there,
Im using this to check one database but how can I have (db_site1, db_site2, db_site3)
if($database_rec[0] == 'db_site1') continue;

Open in new window

Who is Participating?
Roger BaklundConnect With a Mentor Commented:
Sorry, I mismatched the parantheses, it is missing an ) at the end:
if(in_array($database_rec[0],array('db_site1','db_site2','db_site3'))) continue;
# alternative:
if($database_rec[0] == 'db_site1') continue;
if($database_rec[0] == 'db_site2') continue;
if($database_rec[0] == 'db_site3') continue;
# alternative 2:
if(($database_rec[0] == 'db_site1') or 
   ($database_rec[0] == 'db_site2') or 
   ($database_rec[0] == 'db_site3')) continue;

Open in new window

Roger BaklundCommented:
Try this:
if(in_array($database_rec[0],array('db_site1','db_site2','db_site3')) continue;

Open in new window

XK8ERAuthor Commented:
I tried this but it didnt work.. is there another way of doing it?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.