doni49 Posted April 11, 2007 Share Posted April 11, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/46614-wont-insert-to-db/ Share on other sites More sharing options...
doni49 Posted April 11, 2007 Author Share Posted April 11, 2007 Sorry--thought I was posting in the MySQL/PHP forum. Quote Link to comment https://forums.phpfreaks.com/topic/46614-wont-insert-to-db/#findComment-227014 Share on other sites More sharing options...
preston2003 Posted April 16, 2007 Share Posted April 16, 2007 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())"; Quote Link to comment https://forums.phpfreaks.com/topic/46614-wont-insert-to-db/#findComment-230435 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.