note 50566 added to function.implode

From: Date: Thu, 03 Mar 2005 16:29:11 +0000
Subject: note 50566 added to function.implode
Groups: php.notes 
Request: Send a blank email to php-notes+get-85877@lists.php.net to get a copy of this message
A handy use of implode in a MySQL query <?php $id_nums = array(1,6,12,18,24); $id_nums = implode(" OR user_id=", $id_nums); $sqlquery = "Select name,email,phone from usertable where user_id=$id_nums"; // $sqlquery becomes "Select name,email,phone from usertable where user_id=1 OR user_id=6 OR user_id=12 OR user_id=18 OR user_id=24" ?> ---- Manual Page -- http://www.php.net/manual/en/function.implode.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50566 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50566&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50566&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50566&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50566&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50566&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50566&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#85877) next »