Jump to content

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


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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.