List:General Discussion« Previous MessageNext Message »
From:Maximo Migliari Date:May 27 2003 2:36pm
Subject:Re: Select statement driving me crazy
View as plain text  
If the userid is an INT or any other numerical value, you must not use 
quotes when referencing it.  Only use quotes for string values.

i.e.
your query should be:
SELECT userid,subjet,date,code FROM testing WHERE userid=testid

and not

SELECT userid,subjet,date,code FROM testing WHERE userid="testid"


Regards,
Maximo.


At 16:33 27/5/2003 +0200, you wrote:
>Hi,
>
>I'm tired of this statment i don't see where i'm wrong.
>Anyhow,
>here is what i have:
>I have a table called testing
>it has column
>userid
>email
>subject
>message
>date
>sendby
>code
>now I have a select statment on just few of this column not all.
>SELECT userid,subjet,date,code FROM testing WHERE userid="testid"
>There error is:
>You have an error in your SQL syntax near  userid,subject,date,code From
>testing WHERE userid="testid" line1;
>Now I don't see the error, any help is appreciated.
>By the way, the statment is use in my program, which the language is PERL,
>so the actual statment is
>$sth=$dbh->prepare(qq(SELECT userid,subjet,date,code FROM $table WHERE
>userid="$testid"))
>
>any help is well appreciated.
>Anthony
>
>
>
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe:    http://lists.mysql.com/mysql?unsub=1

Thread
Select statement driving me crazyAnthony Ward27 May
  • Re: Select statement driving me crazyMaximo Migliari27 May
  • Re: Select statement driving me crazycolbey27 May
    • Re: Select statement driving me crazyMatthew Smith27 May
  • Re: Select statement driving me crazyAnthony Ward27 May
    • Re: Select statement driving me crazycolbey27 May
  • Re: Select statement driving me crazyAnthony Ward27 May
    • Re: Select statement driving me crazycolbey27 May
      • Auto decrementGary Broughton27 May
        • Re: Auto decrementRomán Sánchez27 May
    • Re: Select statement driving me crazyKeith C. Ivey27 May
  • Re: Select statement driving me crazyJames Moe28 May
RE: Select statement driving me crazyMike Hillyer27 May
Re: Select statement driving me crazyAnthony Ward27 May
Re: Select statement driving me crazyAnthony Ward27 May
RE: Select statement driving me crazyMike Hillyer27 May