jamesm6162 wrote:like e.g. placing the "name" inside single quotes
Actually, doing so would cause a parse error; array indexes inside double-quoted strings should not be quoted, whereas they should be if they appear outside of a string (e.g. in concatenation).
jamesm6162 wrote:Then in your WHERE clause, place single quotes in front and after all strings
James makes a good point - all strings must be quoted, just like in PHP.
Also, whenever you have a SQL problem, the usual approach to debugging a query is like so:
$query = 'SELECT foo FROM bar WHERE ...'; // store query in a variable
$exec = mysql_query($query) or die('MySQL error: ' . mysql_error() . '<br>Query: ' . $query);
That way, if the query fails, you'll get the error message from SQL as well as what your query looked like.