Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/07/2010, 18:51
jotaeva
 
Fecha de Ingreso: junio-2010
Mensajes: 37
Antigüedad: 13 años, 10 meses
Puntos: 0
Problema con "like" usando variable

Código PHP:
Ver original
  1. $recetas= $_GET['txtReceta'];?>
  2.  
  3. <H4><?php echo $recetas?></H4>
  4.  
  5. <?php
  6. $codrec  = mysql_query("SELECT NOMBRE FROM receta WHERE NOMBRE like \'%'.$recetas.'%\'")or die (mysql_error());
  7. ?>

El error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'%'.ARROZ.'%\'' at line 1

La variable se recibe correctamente (txtReceta). Gracias por la ayuda.