php - How to compare or check and matched ids are removed. return remaining values in an array how? -


function removelightok($onlist) {     $remainingvalues= array();     $remainingvalues= explode('' , $onlist);     foreach ($remainingvalues $key){           $query = mysql_query("select * table id = '".$key."'");         $rs= mysql_fetch_assoc($query);                 $id = $rs["id"];                 // how compare or check , matched ids removed. return remaining values in array how?       }     return $remainingvalues; } 

here $onlist means 1 array. ids array. using php only.

you can use ;

function removelightok($onlist) {     $remainingvalues= array();     foreach ($onlist $k => $v){           $query = mysql_query("select * table id = '".$v."'");         $rs= mysql_fetch_assoc($query);         if (!empty($rs["id"]) {             $remainingvalues[] = $v;         }       }     return $remainingvalues; } 

warning: suggest not use mysql_query. php doc page;

this extension deprecated of php 5.5.0, , removed in future. instead, mysqli or pdo_mysql extension should used. see mysql: choosing api guide , related faq more information. alternatives function include:


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -