On Tuesday, March 26, 2002, at 02:12  PM, Jeff Hatcher wrote:

> So my question is how can I put this in the database without having to
> reassign my variable name?

You have to "jump out" of the quoted string that represents your SQL 
query when you echo the value of the $_POST variable.  Like this:

$sql = "SELECT a FROM b WHERE c='" . $_POST['d'] . "'";

Note that I 'jumped out' immediately after the singlequote mark (which 
you need if your value is going into a string field) by closing the 
double-quoted string, using the dot to append the value of the variable 
$_POST['d'], and then using a dot to append another double-quoted string 
(which contains nothing but a single quote in it).

Sometimes, depending on what your variable names look like, you can just 
escape your variable by using braces ('{' and '}'), but I think it's 
just easier to use the dot do appending from string to variable value to 
string again.



Erik Price
Web Developer Temp
Media Lab, H.H. Brown

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to