alabaster_lynch Posted January 8, 2006 Share Posted January 8, 2006 OK, here goes everytime I run this script, I always get Unknown column 'mb5_password' in 'field list' Here is the insert statement $q = "INSERT INTO db_cam_protect (mb5_id, mb5_username, mb5_password, mb5_email, mb5_start_date, mb5_end_date, unixtime_end, mb5_payed, mb5_months, mb5_paytype, mb5_currency, mb5_confirm, mb5_active) values ('".$mb5_id."', '".$mb5_username."', '".$mb5_password."','".$mb5_email."','".$mb5_start_date."','".$mb5_end_date."','".$unixtime_end."','".$mb5_payed."','".$mb5_months."','".$mb5_pay_type."','".$mb5_currency."','0','0')"; mysql_query($q) or die(mysql_error()); Now the particular field in question is produced by a simple random number generator $mb5_password = substr(ereg_replace("[^0-9]", "", crypt(time())) . ereg_replace("[^0-9]", "", crypt(time())) . ereg_replace("[^0-9]", "", crypt(time())),0, 8); srand(time()); Now the database table looks like this CREATE TABLE `db_cam_protect` ( `mb5_id` varchar(20) NOT NULL default '', `mb5_username` varchar(60) NOT NULL default '', `mb5_password` int(11) NOT NULL default '0', `mb5_email` varchar(255) NOT NULL default '', `mb5_start_date` varchar(10) NOT NULL default '', `mb5_end_date` varchar(10) NOT NULL default '', `unixtime_end` varchar(20) NOT NULL default '', `mb5_payed` int(10) NOT NULL default '0', `mb5_months` int(3) NOT NULL default '0', `mb5_paytype` varchar(255) NOT NULL default '', `mb5_currency` varchar(255) NOT NULL default '', `mb5_confirm` int(3) NOT NULL default '0', `mb5_active` int(3) NOT NULL default '0', `mb5_logins` int(11) NOT NULL default '0', `mb5_expirationtime` varchar(20) NOT NULL default '', UNIQUE KEY `mb5_id` (`mb5_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; If you see something I don't, PLEASE let me know...thank you Quote Link to comment https://forums.phpfreaks.com/topic/3166-unknown-column-mb5_password-in-field-list/ Share on other sites More sharing options...
fenway Posted January 8, 2006 Share Posted January 8, 2006 I have good news and bad news. The good news is there's nothing wrong with the INSERT statement that you've posted, or your table design. The bad news is that there's another SQL statement somewhere in your script that _is_ causing this problem. When you use die() as a result of an error, you do what LazyJones always suggests: $result = mysql_query($sql) or die ("ERROR: ".mysql_error()." with query: $sql"); I'll bet it's not the statement that you think it is -- in fact, it could easily be a SELECT statement too! Happy debugging. Quote Link to comment https://forums.phpfreaks.com/topic/3166-unknown-column-mb5_password-in-field-list/#findComment-10737 Share on other sites More sharing options...
alabaster_lynch Posted January 8, 2006 Author Share Posted January 8, 2006 [!--quoteo(post=334591:date=Jan 8 2006, 01:55 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jan 8 2006, 01:55 PM) 334591[/snapback][/div][div class=\'quotemain\'][!--quotec--] I have good news and bad news. The good news is there's nothing wrong with the INSERT statement that you've posted, or your table design. The bad news is that there's another SQL statement somewhere in your script that _is_ causing this problem. When you use die() as a result of an error, you do what LazyJones always suggests: $result = mysql_query($sql) or die ("ERROR: ".mysql_error()." with query: $sql"); I'll bet it's not the statement that you think it is -- in fact, it could easily be a SELECT statement too! Happy debugging. When I set it up as suggested, it said that the posted query was the problem Quote Link to comment https://forums.phpfreaks.com/topic/3166-unknown-column-mb5_password-in-field-list/#findComment-10738 Share on other sites More sharing options...
fenway Posted January 9, 2006 Share Posted January 9, 2006 I have to believe you, but if I create the table you described, and test an INSERT with the specified columns, there's no problem at all. So something's amiss. Quote Link to comment https://forums.phpfreaks.com/topic/3166-unknown-column-mb5_password-in-field-list/#findComment-10743 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.