Re: mysql query problem

From: Date: Thu, 26 Jul 2001 18:11:44 +0000
Subject: Re: mysql query problem
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-10807@lists.php.net to get a copy of this message
ContactID is setup as a tinyint so I dropped the single ticks. No luck. I ran the query in the MySQL client and got the ERROR 1054: Unknown column '$ContactID' in 'where clause'. I know the column ContactID exists. Steve "Josh Hoover" <Josh.Hoover@knowledgestorm.com> wrote in message news:E973048AB322D411AE99009027E32DF685CCF3@FRAZ... > In your query, do you need the single ticks around the $ContactID? Is the > ContactID column a char/varchar field which would require the single ticks? > I'm wondering if that's causing your problem. Also, what if you do that > query via the MySQL client? What do you get then? > > Josh Hoover > KnowledgeStorm, Inc. > jhoover@knowledgestorm.com > > Searching for a new IT solution for your company? Need to improve your > product marketing? > Visit KnowledgeStorm at www.knowledgestorm.com to learn how we can simplify > the process for you. > KnowledgeStorm - Your IT Search Starts Here > > > I'm trying to query my database to fill in data First Name > > Last Name. Using > > the script below I get (depending on the ContactID I enter) > > > > Contact: 1 1 or 2 2 > > > > If ContactID=0 I get > > > > Contact: > > > > Any ideas on what I am doing wrong? > > > > Thanks. > > > > Steve Fitzgerald > > > > <?php > > $sql="SELECT * FROM contacts WHERE ContactID='$ContactID'"; > > $result = mysql_query($sql,$db); > > > > printf("%s\n", mysql_result($result,"FirstName")); > > > > printf("%s<br>\n", mysql_result($result,"LastName")); > > > > > > ?> >

« previous php.db (#10807) next »