On Jun 24, 2011, at 6:28 AM, Chris Stinemetz wrote:
So I am trying to keep this simple and just assign the value with the
radio button and then insert it into mysql database, but with the
following code I am getting the mysql error: Unknown column '250kbps'
in 'field list' when I choose the first radio button.
I think it has to do with the value being a string, but I haven't been
able to figure out the fix.
This one's fairly simple. You need to surround string values in the
SQL with quote marks (single or double will do so it doesn't get
confused about what the value you're trying insert is.
" . $_POST['post_tptest'] . ",
'" . $_POST['post_tptest'] . "',
Since you're using double quotes to enclose the SQL statement, use
single quotes to enclose the actual string you're inserting.
Did you know that if you use a PHP variable inside a double quoted
string it will be interpolated correctly? No need to break it up with
concatenation, etc., if you don't want to. It's possibly debatable
which is the best practice and which is a bigger performance hit.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php