Ver Mensaje Individual
  #6 (permalink)  
Antiguo 14/09/2012, 09:30
Avatar de ricardo_yah
ricardo_yah
 
Fecha de Ingreso: agosto-2012
Mensajes: 22
Antigüedad: 12 años, 7 meses
Puntos: 1
Respuesta: Copiar Fila de grid

Código PHP:
<?php

class Buscador {
    
var 
$host='127.0.0.1',$user='root',$pass='cefierros',$db='licencias',$c_Servidor='Seconecto',$i_Servidor='no se conecto',$c_DB='selecciono la db',$i_DB='no selecciona DB';
    function 
Conectar() {
        if (!@
mysql_connect($this->host,$this->user,$this->pass)){
        print 
$this->i_Servidor;
        }else{
            if(!@
mysql_select_db($this->db)){
                print 
$this->i_DB;
            }  
        }
        
    }
    
    function 
Buscar($q) {
        
$query mysql_query("SELECT * FROM clientes where nombre LIKE '%$q%'");
        if (
mysql_num_rows($query)<=0){
            print 
'No se encontro ningun resultado';
        } else {
            echo 
"<table class='distabla' width='100%' border='1'  cellspacing='0' cellpadding='0' >";
            
echo 
"<tr>
<th>Idcliente</th>
<th>Nombre</th>
<th>Domicilio</th>
</tr>"
;
                
            while (
$row mysql_fetch_assoc($query)) {
            
//echo "<tr onclick=\"document.getElementById('idclient').value=$row[idcliente];\">
            
echo "<tr onclick=\"document.getElementById('idclient').value=$row[idcliente];
            document.getElementById('nombre').value=$row[nombre];
            \">
                  <td>"
.$row['idcliente']."</td>";
            echo 
"<td>".$row['nombre']."</td>";
            echo 
"<td>".$row['domicilio']."</td>
                 </tr>"
;
                
            }
            echo 
'</table>';
        }
   
     }

   }
   
?>