Hacer un query a un Array
| From: | Oswaldo Otero | Date: | Fri, 18 Mar 2005 16:38:28 +0000 |
| Subject: | Hacer un query a un Array | ||
| Groups: | php.general.es | ||
| Request: | Send a blank email to general-es+get-53704@lists.php.net to get a copy of this message | ||
Hola a todos, quiero hacer algo como mandar un query a un arry, en la
clausula where eso se puede, creen que existe otra forma de hacerlo.
Seria algo como esto.
<?session_start();
include('../config.php');
//So here start the really hard work, this is a really, lib, for
//get how many are there pending for be check by the doctor.
//That's it..
//-------------First
//A simple SQL, Connection
$connection=mysql_connect($db_host,$db_user,$db_pass);
$selection=mysql_select_db('grouprx_com',$connection);
//-------------Second
//So we have to make and array, for get all the clients, taht this
doctor have to attend...
//This query is for get, what client work with the login doctor...
//By the way, we make a array, for consult the order table...
$sql='SELECT * FROM
clientdoctor WHERE doctorid
="'.$doctorid.'"';
$result=mysql_db_query($db,$sql);
$how_many_clients=mysql_num_rows($result);
//------------Third
//Then, we have to get all the client id of the people(clients) and
put them in an array...
for($i=0;$i < $how_many_clients;$i++)
{
$data=mysql_fetch_array($result);
$arr_clients[$i]=$data['clientid'];
}
//-------------Fourth
//Well Done, we got the array, so let us try if we can run another
query where the WHERE condition is executable into and
array=====>>>$arr_clients.
$sql1='SELECT * FROM orders WHERE
clientid="'.$arr_clients.'"
and status="N"';
$result1=mysql_db_query($db,$sql1);
$pending_orders=mysql_num_rows($result1);
?>
Si ven en la sentencia $sql1, quiero meter por clausula un array, eso
se puede???? Como podria hacerse algo similar...
Gracias por las ideas
--
Oswaldo Otero en Gmail
La "G" es de GEEK