Google
Web dns.bdat.net

[PHP-ES] Hacer un query a un Array

Write haof XML files: Oswaldo Otero ( oswaldo.otero(EN)gmail.com)
Fecha: vie 18 mar 2005 - 17:38:28 CET


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
-- 
PHP Spanish Localization Talk Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Este archivo fue generado por hypermail 2.1.7 : sáb 19 mar 2005 - 01:01:24 CET