Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/12/2008, 12:27
Avatar de bacdavi
bacdavi
 
Fecha de Ingreso: junio-2006
Ubicación: http://localhost/
Mensajes: 351
Antigüedad: 17 años, 11 meses
Puntos: 7
Exclamación Ayuda con script php & MySQL

hola amigos:
Me podrian ayudar a encontrar el error de este query de MySQL que ya esta montado en php, y me despliega los siguientes errores:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\..\busqueda.php on line 54

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\..\busqueda.php on line 57

Este es el código:

Código PHP:
<?php 
mysql_connect
('localhost','root','') or
die(
"Imposible conectarse: " mysql_error());
mysql_select_db('subsidios');
// CREACION DEL SQL SEGUN LO INGRESADO
$sql_misubsidio="SELECT 
    sub.nombre1 AS NOMBRE1,
    sub.nombre2 AS NOMBRE2,
    sub.apellido1 AS APELLIDO1,
    sub.apellido2 AS APELLIDO2,
    sub.apellido3 AS APELLIDO3,
    CONCAT(sub.cedula_orden,'-',sub.cedula_registro) AS CEDULA,
    sub.ese AS ESE,
    sub.expediente AS EXPEDIENTE,
    sub.direccion DIRECCION,
    sub.direccion_depto AS DIRDEPTO,
    sub.direccion_mun AS DIRMUNICIPIO,
    sub.acta_id AS ACTA,
    CONCAT(sub.direccion_depto,', 'sub.direccion_mun) AS DIRECCION,
    sub.proy_id AS PROYECTO
FROM
    tbl_subsidiados sub,
WHERE
   "
;
switch (
$op) {
    case 
1:        //buscara por cedula
    
$condicion='sub.cedula_orden="'.$LSTcedula_orden.'" AND sub.cedula_registro="'.TXTced_registro.'"';
    break;
    case 
2:     //buscara por nombre
    
$condicion='CONCAT(TRIM(sub.nombre1)," ",TRIM(sub.nombre2)," ",TRIM(sub.apellido1)," ",TRIM(sub.apellido2)," ",TRIM(sub.apellido3)) LIKE "%'.strtoupper(str_replace(" ","%",trim($TXTnombre))).'%"';
    break;
    case 
3:        //buscara por ESE
    
$condicion='sub.ese="'.$TXTese.'"';
    break;
    case 
4:        //buscara por Expediente
    
$condicion='sub.expediente="'.$TXTexp.'"';
    break;
}
$sql_misubsidio=$sql_misubsidio.$condicion."
ORDER BY ESE"
;
?>
<?php 
echo $sql_misubsidio;?>
<table width="98%" border="0" align="center" cellpadding="00" cellspacing="0">
                      <tr>
                        <td width="24" class="tablas">No.</td>
                        <td width="83" class="tablas">Expediente</td>
                        <td width="117" class="tablas">ESE</td>
                        <td width="117" class="tablas">Nombre</td>
                        <td width="96" class="tablas">Cédula</td>
                        <td width="124" class="tablas">Dirección</td>
                        <td width="44" class="tablas">Acta</td>
                        <td width="48" class="tablas">PRY</td>
                      </tr><?php
                      $ges 
mysql_query($sql_misubsidio);
                      
$hay=mysql_num_rows($ges);
                      
$zebra=0;
                      
$cuenta=0;
                        while (
$gestion mysql_fetch_array($ges)) { //inicio del listado
                            
$cuenta=$cuenta+1;?>
                      <tr <?php if ($zebra==1) { echo ' bgcolor="#eff0f1"';
           
$zebra=0; } else { echo ' bgcolor="#FFFFFF"';
        
$zebra=1;}?>>
                        <td valign="top"><div align="right"><?php //echo $cuenta?>&nbsp;</div></td>
                        <td valign="top"><a href="#" target="_self"><?php echo $gestion['EXPEDIENTE'];?></a></td>
                        <td valign="top"><?php echo $gestion['ESE'];?></td>
                        <td valign="top"><?php echo $gestion['NOMBRE1']." ".$gestion['NOMBRE2']." ".$gestion['APELLIDO1']." ".$gestion['APELLIDO2']." ".$gestion['APELLIDO3']?></td>
                        <td valign="top"><?PHP echo $gestion['CEDULA'];?></td>
                        <td valign="top"><?php echo $gestion['DIRECCION'];?></td>
                        <td valign="top"><?php if ($gestion['ACTA']<>1) {echo $gestion['ACTA'];}?></td>
                        <td width="48" valign="top"><a href="ficha.php?kod=<?php echo $gestion['PROYECTO'];?>" target="_blank"><?php if ($gestion['PROYECTO']<>1) {echo $gestion['PROYECTO'];}?></a></td>
                      </tr>
                      <? // fin del while para el listado de resultado?>
                    </table>
</td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                  </tr>
                </table>
De antemano muchas gracias por la ayuda!

Última edición por bacdavi; 17/12/2008 a las 12:27 Razón: se me olvido agradecer de antemano la ayuda