Ver Mensaje Individual
  #5 (permalink)  
Antiguo 22/07/2009, 14:09
mega0079
 
Fecha de Ingreso: agosto-2008
Mensajes: 272
Antigüedad: 15 años, 8 meses
Puntos: 1
Respuesta: cmo se hace esta consulta

no me sale :S pero la consulta es la correcta?, a lomejor tengo un problema con el codigo
Código PHP:
if (!isset($codigo)){ 
      echo "Debe especificar un codigo"; 
      exit;  

$link = mysql_connect("localhost", "root", "pass"); 
mysql_select_db("midb", $link); 
$result = mysql_query("SELECT * FROM productos WHERE Codigo||modelo LIKE '%{$codigo}'||'{$modelo}%'ORDER BY Codigo", $link); 
  



?>
</p>
<p>&nbsp;</p>
<form method="post" action="busca.php">
  <td colspan="2" bgcolor="#FFFFFF"><input name="codigo" type="text" size="40"></td>
<td width="259" bgcolor="#FFFFFF"> <p>
  <input type="submit" name="submit" value="Buscar"> 
</p>
  <p>
    <label>modelo
      <input type="text" name="modelo" id="modelo">
    </label>
  </p>
</form>
<?php 
if ($row mysql_fetch_array($result)){ 
      echo 
"<table border = '1'> \n"
     
      echo 
"<td>Codigo</td> \n"
      echo 
"<td>Descripcion</td> \n"
    
//Mostramos los nombres de las tablas 
echo "<tr> \n"
while (
$field mysql_fetch_field($result)){ 
            echo 
"<td>$field->name</td> \n"
            
            } 

      echo 
"</tr> \n"
do { 

            echo 
"<tr> \n";
            echo 
"<td>".$row["Codigo"]."</td> \n"
            echo 
"<td>".$row["Descripcion"]."</td> \n"
                        
             
        
            
         
            echo 
"</tr> \n"
      } while (
$row mysql_fetch_array($result)); 
            echo 
"</table> \n"
} else { 
echo 
" No se ha encontrado ningun registro."?> 
<script type='text/javascript'>
document.write('<p class="details"><a href="javascript:history.go(-1);">REGRESAR</a></p>');</script>
<?php 

?> 
</body>
</html>