Jump to content

Recommended Posts

I'm trying to insert records to my DB.  The currently user has ALL priviledges on this DB.  here's a snippet of my code:

$query1 = "INSERT INTO users (username, domainname, first_name, last_name, password, registration_date, secretAU, secretQU, secretAP, secretQP, email, TOSNum, AUPNum, currentPlan, currentAmt, currentPeriod, lastUpdated) ";
$query2 = "values ('$u', '$dn', '$fn', '$ln', PASSWORD('$p'), NOW(), '$sau', '$squ', '$sap', '$sqp', '$e','$currentTOSNum', '$currentAUPNum', '$currentPlan', '$currentAmt', '$currentPeriod', NOW())";

and the table's structure:

CREATE TABLE `users` (
  `user_id` mediumint( unsigned NOT NULL auto_increment,
  `acctStatus` tinyint(1) NOT NULL default '0',
  `username` varchar(20) NOT NULL default '',
  `domainname` varchar(25) NOT NULL default '',
  `first_name` varchar(15) NOT NULL default '',
  `last_name` varchar(30) NOT NULL default '',
  `email` varchar(40) NOT NULL default '',
  `password` varchar(100) NOT NULL default '',
  `registration_date` datetime NOT NULL default '0000-00-00 00:00:00',
  `phone_num` varchar(20) NOT NULL default '',
  `secretQU` varchar(255) NOT NULL default '',
  `secretAU` varchar(255) NOT NULL default '',
  `secretQP` varchar(255) NOT NULL default '',
  `secretAP` varchar(255) NOT NULL default '',
  `currentPlan` varchar(12) NOT NULL default '',
  `currentAmt` float NOT NULL default '0',
  `currentPeriod` varchar(15) NOT NULL default '',
  `lastUpdated` date NOT NULL default '0000-00-00',
  `numRecords` tinyint(4) NOT NULL default '25',
  PRIMARY KEY  (`user_id`),
  UNIQUE KEY `username` (`username`,`email`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=29 ;

Thinking that maybe there was a bad value in one of the variables, I added the following right above the query2 line:

echo $u . "<br>"  . $dn . "<br>"  . $fn . "<br>"  . $ln . "<br>"  . $p ."<br>" . $sau . "<br>"  . $squ . "<br>"  . $sap . "<br>"  . $sqp . "<br>"  . $e . "<br>"  . $currentTOSNum . "<br>"  . $currentAUPNum . "<br>"  . $currentPlan . "<br>"  . $currentAmt . "<br>"  . $currentPeriod . "<br>";

and it produces the following:

username

domain.com

fname

lname

mypass

Mary

What was your first girlfriend\\\'s name

Gerald

what is your father\\\'s middle name?

username@domain.net

1

1

1

10.95

month

 

Link to comment
https://forums.phpfreaks.com/topic/46614-wont-insert-to-db/
Share on other sites

Try this.

 

$query1 .= "INSERT INTO users (username, domainname, first_name, last_name, password, registration_date, secretAU, secretQU, secretAP, secretQP, email, TOSNum, AUPNum, currentPlan, currentAmt, currentPeriod, lastUpdated) ";

$query2 .= "values ('$u', '$dn', '$fn', '$ln', PASSWORD('$p'), NOW(), '$sau', '$squ', '$sap', '$sqp', '$e','$currentTOSNum', '$currentAUPNum', '$currentPlan', '$currentAmt', '$currentPeriod', NOW())";

 

Link to comment
https://forums.phpfreaks.com/topic/46614-wont-insert-to-db/#findComment-230435
Share on other sites

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.