View Single Post
Old 05-19-2006, 06:31 PM   #1 (permalink)
huck
Junior Member
 
Join Date: Apr 2006
Posts: 11
Default Problem submitting data to a database.

Ok. I'm sure this is a super simple fix, but for some reason I'm not seeing it. Any help would be good.

The PHP is designed to capture certain information about the site visitor, and then store them in a database. Simple, really. The information is being captured, but for some reason, it's inputting the variable names into the database, instead of the values.

I'm assuming it's something to do with the variable names being in brackets?

Code below. (The relevant section)

Code:
$date = date("D dS F, Y"); $time = date("g:i:sa"); //find out how to get this back into GMT $ip = $_SERVER['REMOTE_ADDR']; $referer = $_SERVER['HTTP_REFERER']; $useragent = $_SERVER['HTTP_USER_AGENT']; /*Adds the data to the database*/ $db = "databasename"; $result = mysql_select_db($db) or die("Unable to select the database, but could connect to server"); $adduserinfo = 'INSERT INTO `userlogging` (`ID`, `date`, `time`, `IP`, `browser`, `referer`) VALUES (\'\', \'$date\', \'$time\', \'$ip\', \'$useragent\', \'$referer\')'; $adduserinforesult = mysql_query($adduserinfo) or die ("Error in query $adduserinfo");
huck is offline   Reply With Quote
Sponsored Links