Update query to find out registered ids from an array in php -
i trying find out ids in array registered or updated in database. how can customize query add array of ids $ids
, make query check ids in array if
1- registered , visibility 1 , update_time > :update_time
here code
function getonlinecontacts() { try { $conn = $this->getdbconnection(); $update_time = time() - 120; $ids = array($_post['ids']); $statement = $conn->prepare('select linkedinid users update_time > :update_time , visibility = 1'); $statement->bindparam(':update_time', $update_time, pdo::param_str); $statement->execute(); $conn = null; } catch(pdoexception $e) { throw $e; } }
assuming id field named id
, try this
$ids = implode(",",$_post['ids']); $statement = $conn->prepare('select linkedinid users update_time > :update_time , visibility = 1 , id in(:ids)'); $statement->bindparam(':update_time', $update_time, pdo::param_str); $statement->bindparam(':ids', $ids, pdo::param_str);
note, work have have ids
coming html form name ids[]
Comments
Post a Comment