The important part of my answer is: "Within double quoted strings (and heredocs), variables are interpolated." The statement about single quotes is just an aside, noting that single quotes within double quotes do not function as single quotes outside of strings (i.e. single quotes do not prevent variable interpolation).
At this point, it's not entirely clear what you're asking about. Are you asking about PHP or MySQL's handling of the string? Part of my difficulty is I'm not sure what your conceptual framework is. As you post more, the clearer it will become.
Not exactly. Within the PHP script is a double quoted string of no particular meaning. If it contains references to variables, they are replaced by the contents of the variables (after conversion to strings, if necessary). The resulting string is passed to the function mysql_query, which sends the string to MySQL. MySQL parses it as an INSERT, and the expressions "'Tom'" and "'Jones'" are parsed as strings (the varchar type is used for tables and procedures, not expressions). PHP contains no concept of SQL, and variables and strings in SQL are completely separate from PHP variables and strings.


LinkBack URL
About LinkBacks

Reply With Quote
