Jump to content

MYSQL ERROR when copying record to another table!! Please Help!


dt_gry

Recommended Posts

??? ??? ??? ??? ??? ??? ???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);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.