INSERT INTO - problem!? please help

Codes here !

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 60
Joined: Sun Feb 02, 2003 2:10 am
Location: Leeds, Uk

Sun Feb 02, 2003 3:28 am

Right i have made this code for a stats page, so it will collect the user Ip and stuff, but i have a problem when running the srip i get a parse eror on the INSERT line or the query line, can anyone tell me whats wrong !?

//getting the user's IP address
//getting the user's Port

//Getting the user's Browser (Agent)

//getting the referries URL

//Put all this into a Database for later viewing:

//connect to the DB

//select DB

//setting the query in a variable, the query, in this case it
//INSERTS to the db

$query="INSERT INTO cstats ('ip','port','browser','reffer','date') VALUES ('$Rip','$Rport','$b','$r','');

//running the actual query

Keep it punk!!
Peace Out

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Sun Feb 02, 2003 4:58 am

$query="INSERT INTO cstats (`ip`,`port`,`browser`,`reffer`,`date`) VALUES ('$Rip','$Rport','$b','$r','');

New php-forum User
New php-forum User
Posts: 9
Joined: Sun Feb 02, 2003 6:54 pm
Location: Milwaukee

Sun Feb 02, 2003 7:07 pm

Try this,

$query="INSERT INTO cstats VALUES ('$Rip','$Rport','$b','$r', NULL)";

Your example recieved a parse error because of the placement of the quotes. You were recieving a PHP error, not a mysql error. You will also need a semi-colon after the mysql_query.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests