Query Woes

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Query Woes

Postby timstring » 20. January 2012 23:35

This makes absolutely no sense: When I run this query:


$namepost = "Gilbert";
$Quest = "SELECT * FROM `Users` WHERE `TechID` = `$namepost`";

MySQL returns the error message: "Unknown column 'Gilbert' in 'where clause'" TechID is my column name, not "Gilbert" If I take "$namepost" out of the query and replace it with a definite value, it works
"If builders built buildings the way that programmers write programs, the first woodpecker to come along would destroy civilization."
User avatar
timstring
 
Posts: 22
Joined: 17. September 2010 02:16

Re: Query Woes

Postby Altrea » 20. January 2012 23:37

use single-quotes ' for strings, and backticks ` for table and column names.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
free software according to purpose of usage
XAMPP 1.8 for local development/testing only
Zend Server 6 (free) for production environments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 4528
Joined: 17. August 2009 13:05
XAMPP Version: 1.8.1
Operating System: W7Ux64


Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 3 guests