hello forum
im trying to insert record in different table using single query (on the base of class, class name and tables name are same)and wants to insert record in 1 table at 1 time is it possibol to select the table name through class here is the code but its is nt working

$dbhandle = mysql_connect('localhost', 'root', '');

        if ($dbhandle == false)
                 die  ("Unable to connect to MySQL Database<br>");

if(!($db = mysql_select_db('registration'))){
echo "byeeeeeeeeeeeeeeeeeeeeeeeeeeee";


$q2="INSERT INTO".$tab."(ser,sub1,sub2,sub3,sub4,sub5,sub6,total,obtain,percentage,remarks)values(".$ser.",'".$sb1."','".$sb2."','".$sb3."','".$sb4."','".$sb5."','".$sb6."','".$tot."','".$obt."','".$percent."','".$remark."')";
//$result = mysql_query($q2);
echo $tab;
if(!($result = mysql_query($q2))){
echo "whoooooooooooooooooooooops";
echo "<br>";

echo $ser;
echo $tab;


the query is wrong. there are no spaces between INTO and your tablename, therefor the query will return an error.