By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 1,960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

Insert Checkbox value in mysql using php

P: 1
<input name="like" type="checkbox" value="yes" checked/>

__________________________________________________ ________

if(isset($_POST['like'])){

$likeuser = "yes";

mysql_query("INSERT INTO comments (LJ)
VALUES ('$likeuser')") or die ("could not add like yes " . mysql_error());

} else {

$likeuser = "no";

mysql_query("INSERT INTO comments (LJ)
VALUES ('$likeuser')") or die ("could not add like no " . mysql_error());

}


-----------------------------------------------
mysql LJ varchar(10)


ERROR:
could not add like yes Unknown column 'LJ' in 'field list'

i want to add value "yes" if check is selected by user and "no" for user not checked.

Thanks in advance.
Oct 9 '11 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,349
It's saying that there's no field named LJ in your comments table.
Oct 9 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.