mysql query not working!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
paqman
Forum Contributor
Posts: 125
Joined: Sun Nov 14, 2004 7:41 pm
Location: Burnaby, BC, Canada

mysql query not working!

Post 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')");
ofermisk
Forum Newbie
Posts: 5
Joined: Sun Nov 26, 2006 6:07 am

Mysql

Post 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')");
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Post Reply