dt_gry Posted October 13, 2008 Share Posted October 13, 2008 ??? ??? ??? ??? ??? ??? ???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 ''Uname','CurDate','StartTM','14:46:21','IPadd') SELECT * FROM ActivityUsers' at line 1 <?php // set database connection information. // $host - the mysql server address. // $user - the username to access database. // $pass - the password to access database. // $database - the name of the database that is desired. // $table - the name of the desired table. // $CurDate - gets and stores the current date // $StartTm - gets and stores the current time // $IPadd - gets and stores the ip address of the client computer. // Gets required user data $CurDate = date('m-d-y'); $EndTm = date('H:i:s'); $IPadd = $_SERVER['REMOTE_ADDR']; $UserID = $uname; // Database connection info $host = 'mysql.thegayestwebsiteever.com'; $user = 'thegayestever'; $pass = '***********'; $database = 'useractivity_tgwse'; $Active_tbl = 'ActivityUsers'; $Log_tbl = 'ActivityLog'; // connect to the mysql database server. $connect = mysql_connect($host, $user, $pass) or die(mysql_error()); mysql_select_db($database) or die(mysql_error()); $add_info = "INSERT INTO $Log_tbl ('Uname','CurDate','StartTM','$EndTm','IPadd') SELECT * FROM $Active_tbl ('Uname','CurDate','StartTm','IPadd') WHERE ID='$UserID'"; mysql_query($add_info) or die(mysql_error()); mysql_close($connect); ?> Quote Link to comment https://forums.phpfreaks.com/topic/128277-mysql-error-when-copying-record-to-another-table-please-help/ Share on other sites More sharing options...
revraz Posted October 14, 2008 Share Posted October 14, 2008 Remove all the single quotes in your query, except this one WHERE ID='$UserID'"; Quote Link to comment https://forums.phpfreaks.com/topic/128277-mysql-error-when-copying-record-to-another-table-please-help/#findComment-664925 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.