Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/06/2011, 09:49
jchavez
 
Fecha de Ingreso: mayo-2011
Ubicación: Bogota
Mensajes: 35
Antigüedad: 13 años
Puntos: 0
Pregunta Select Caracteres

Hola tengo un input en php con el nombre

<select name="item">
<option>Pc</option>
$items = $_POST['item'];

le doy que me imprima el valor
echo $items; y me imprime Pc,

ahora tengo una BD y hago un select * from tabla campo = 'Pc'
y me arroja la consulta, lo mediante PHP, Y Me arroja error.
$descrip ="select * from tabla where campo = /'.$items.'"; y me arroja

Unknown column 'Pc' in 'field list'

alguien me podria indicar por que sucede esto.

$descrip ="select * from tabla where campo = \'\".$items.\"\'"; pero tambien me arroja 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 '\'".Pc."\'' at line 1