Just learning ...
This retrieves zero records:
$z="55555";
$query = 'SELECT * FROM `UserNames` WHERE Zip="$z"';
This gets them all:
$query = 'SELECT * FROM `UserNames` WHERE Zip="55555"';
What's the difference and how do I use a variable name?
Thanks,
newbie9999
coding error?
Moderator: General Moderators
Re: coding error?
The manual is always a good place to start. Take a look at the "single quotes" section of that page.
-
newbie9999
- Forum Newbie
- Posts: 2
- Joined: Tue Nov 03, 2009 7:09 pm
Re: coding error?
Thanks for your very unhelpful answer. Where do you suppose I got the rest of the code?
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: coding error?
Not from the link that tasairis posted.newbie9999 wrote:Thanks for your very unhelpful answer. Where do you suppose I got the rest of the code?
Check it and learn how variable interpolation works within strings that are single quoted as opposed to double quoted.
-Shawn
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.