Jump to content

Archived

This topic is now archived and is closed to further replies.

alabaster_lynch

Unknown column 'mb5_password' in 'field list'

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

[!--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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

×

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.