RE: [PHP-DB] mysql query problem

From: Date: Thu, 26 Jul 2001 17:48:23 +0000
Subject: RE: [PHP-DB] mysql query problem
Groups: php.db 
Request: Send a blank email to php-db+get-10805@lists.php.net to get a copy of this message
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 (#10805) next »