The code given below is showing error:
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group,type) SELECT ex_tax.username,ex_tax.exp_id,exp' at line 1

$sql="INSERT INTO ex_cat (username,exp_id,used_category,group,type)
SELECT ex_tax.username,ex_tax.exp_id,ex_tax.category,ex_tax.group,ex_tax.type
FROM ex_tax WHERE ex_tax.username='$uname' AND ex_tax.exp_id='$exp_id' AND ex_tax.used='1'";

Recommended Answers

All 2 Replies

post structure of ex_cat, and ex_tax
or try with ` around word group, because group is reserved word

$sql="INSERT INTO ex_cat (username,exp_id,used_category,`group`,type)
SELECT ex_tax.username,ex_tax.exp_id,ex_tax.category,ex_tax.`group`,ex_tax.type
FROM ex_tax WHERE ex_tax.username='$uname' AND ex_tax.exp_id='$exp_id' AND ex_tax.used='1'";

Thanks a lot urtrivedi :)
It is solved... ws cz of 'group' i changed it and now it works :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.