> That said, (Now on to actual PHP) I've noticed (in my own scripting) and a
> few other problems posted here quite a bit of confusion with PHP's single '
> and double " quotes.  Reading the material I was led to believe that
> '   ' outputs exactly what is in the quotes and
> "   " outputs variables and strings (etc..)
> Thus I become radically confused by this recent comment to use '"$uname"'.
> And furthermore the solutions to one of my MySql query problems being adding
> single quotes ' ' to all the variables.  Now by my understanding, thats not
> supposed to work.  However, being PHP what it is.. I wasn't suprised.
> (There's some open-source commentary for ya'.)  Perhaps I am now thinking,
> these quotes have diffrent meanings when applied in MySql queries, and
> perhaps other DB types.  (I haven't really been paying attention to any
> other database tytpe fodder.)  And furthermore, does thje function of the '
> and " change in other commands?  I could really use a complete description
> on this.  Perhaps a link to some long overdue resource I should have read
> months ago before I designed my current project?

You are confusing PHP stuff and database stuff.

'...' prints ... literally regardless of what ... is

So, whoever suggested to use '"$uname"' was on drugs

However, if you have something like this:

mysql_query("insert into blah values ('$uname',$age)");

It is still quite consistent.  Variables get expanded inside double quotes
in PHP.  single quotes inside a double-quoted string are just like any
other character to PHP.  MySQL expects strings to be surrounded by single
quotes in all queries.  This has nothing to do with PHP.


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to