Page 1 of 1

mysql query not working!

Posted: Mon Nov 27, 2006 12:27 am
by paqman
I've been working on a page all day and this little piece of it won't create a new row in the database (but one right before it does). I can't think anymore, can anyone see what I'm doing wrong? Thank you so much!

Code: Select all

// data for each field
$rq_unique = $_POST["email"];
$rq_ip = $REMOTE_ADDR;
$rq_session = $PHPSESSID;
$timezone  = -8;
$rq_time = gmdate("g:i A", time() + 3600*($timezone+date("I")));
$rq_date = gmdate("M d/y", time() + 3600*($timezone+date("I")));
$rq_type = "Lost User Name";

$sendit=MYSQL_QUERY("INSERT INTO 'requestrack' (rqid,ip,unique,session,date,time,type) VALUES ('NULL', '$rq_ip', '$rq_unique', '$rq_session', '$rq_date', '$rq_time', '$rq_type')");

Mysql

Posted: Mon Nov 27, 2006 12:35 am
by ofermisk
Hi,The reqId is an auto increamented id? why you add the NULL statement?
Does PHP return an error saying something like "duplicated id"?
Try to create the row without the reqId field :

Code: Select all

$sendit=MYSQL_QUERY("INSERT INTO 'requestrack' (ip,unique,session,date,time,type) VALUES ( '$rq_ip', '$rq_unique', '$rq_session', '$rq_date', '$rq_time', '$rq_type')");

Posted: Mon Nov 27, 2006 12:38 am
by feyd
  • Use of register global like variables, possibly in a disabled environment
  • the string NULL given the database instead of a NULL value.
  • use of a reserved word for several field names
  • use of odd date and time formats
  • use of user submitted data without any escapement, validation or verification.