I tried out something similar to what you had suggested to see whats happening with my query variables...
Code:
if(mysql_query("INSERT INTO $groupFullName (usrip, user, status) VALUES ('$ipaddr', '$thisuser', '$isonline')")){
echo "Success";
}else{
echo "INSERT ERROR:".mysql_error();
}
echo "<br/><br/>INSERT INTO $groupFullName (usrip, user, status) VALUES ('$ipaddr', '$thisuser', '$isonline')";
And I got this....
Quote:
INSERT 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 '(usrip, user, status) VALUES ('', '', '')' at line 1
INSERT INTO (usrip, user, status) VALUES ('', '', '')
So why am I getting empty variables in my output when I had passed this in my URL:
Quote:
mysite.com/testing.php?gid=bluebell&usersid=henry&gmode=join&islock=off&accessid=abc
---------------------------------------------------------------------
And later I tried this....
Code:
$copystr="GRP_".$groupFullName."_users";
if(mysql_query("INSERT INTO $copystr (usrip, user, status) VALUES ('$ipaddr', '$thisuser', '$isonline')")){
echo "Success";
}else{
echo "INSERT ERROR:".mysql_error();
}
echo "<br/><br/>INSERT INTO $copystr (usrip, user, status) VALUES ('$ipaddr', '$thisuser', '$isonline')"
..and this is the output I got...
Quote:
INSERT ERROR:Table 'b20_mydb_chatbox.GRP__users' doesn't exist
INSERT INTO GRP__users (usrip, user, status) VALUES ('', '', '')
Now I tried replacing $groupFullName by $_GET['gid']
Code:
$copystr="GRP_".$_GET['gid']."_users";
if(mysql_query("INSERT INTO $copystr (usrip, user, status) VALUES ('$ipaddr', '$thisuser', '$isonline')")){
echo "Success";
}else{
echo "INSERT ERROR:".mysql_error();
}
echo "<br/><br/><br/><br/>INSERT INTO $copystr (usrip, user, status) VALUES ('$ipaddr', '$thisuser', '$isonline')"
Here is the output:
Quote:
INSERT INTO GRP_bluebell_users (usrip, user, status) VALUES ('', '', '')
It works now. I checked the table(GRP_bluebell_users), and found that a record has been inserted into this table with empty datas under columns (usrip, user, status). So again had to create new variable copies of $ipaddr, $thisuser, $isonline just like I did with table name.
I want to know why this is happening? Why cant I simply use the same variables instead of a creating a new one?