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.
[EMAIL PROTECTED]

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"));
> 
> 
>   ?>

Reply via email to