🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #440

Re: problema consulta php mysql

#440
From: TheSpawn
Date: Tue, 09 Jun 2009 16:58
31 lines
1874 bytes
Prueba colocando comillas en la variable que viene por POST, o sea,

$tablaclientes = mysql_query("SELECT * FROM cliente where Id_cliente
='".$_POST['seldestino']."'");

Prueba de esa manera.

Saludos.

TheSpawn



"jose viveros" <jviveros@lmn.cl> wrote in message 
news:h0m0te$hr1$1@jagger.tie.cl...
> estoy comenzando con php y tengo un problema, al hacer una consulta de sql 
> dentro de un php si la condicion tiene algo que no sea solo numeros no me 
> devuelve ningun valor pero si solo tiene numeros me los devuelve sin 
> problemas, pongo la consulta
>
>
> $tablaclientes = mysql_query("SELECT * FROM cliente where Id_cliente 
> =".$_POST['seldestino']);
>
>
> si  "$_POST['seldestino']" (que es un rut) tiene solo numeros la consulta 
> funciona pero si tiene una letra final el error que me devuelte es que la 
> clausula es desconocida.
>
> alguna idea?
> 
Technical Details
Message-ID: <h0m4ct$scb$1@news.nivel5.cl>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news.kjsl.com!news.nivel5.cl!not-for-mail
References: <h0m0te$hr1$1@jagger.tie.cl>

Show Full Headers
Complete Article Headers
X-Google-Thread: e499fe1f24,a2a1c6bfa281fdd9
X-Google-Attributes: gide499fe1f24,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: SPANISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news.kjsl.com!news.nivel5.cl!not-for-mail
From: "TheSpawn" <al_simmon_spawn(sinesto)@hotmail.com>
Newsgroups: chile.comp.programacion
Subject: Re: problema consulta php mysql
Date: Tue, 9 Jun 2009 12:58:57 -0400
Organization: Varios
Lines: 33
Message-ID: <h0m4ct$scb$1@news.nivel5.cl>
References: <h0m0te$hr1$1@jagger.tie.cl>
NNTP-Posting-Host: pc-195-179-47-190.cm.vtr.net
X-Trace: news.nivel5.cl 1244566749 29067 190.47.179.195 (9 Jun 2009 16:59:09 GMT)
X-Complaints-To: news@news.nivel5.cl
NNTP-Posting-Date: Tue, 9 Jun 2009 16:59:09 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350
X-RFC2646: Format=Flowed; Response