MyBB Community Forums

Full Version: Bug in mysql_db_tables.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Setting up a new mybb 1.6.4 I run into a mysql-error. I could track this down to the file mysql_db_tables.php in install/resources (line 48 and 50, where the fieldnames 'type' and 'fields' are not escaped and therefore confused mysql). The following works:

$tables[] = "CREATE TABLE mybb_adminviews (
	vid int unsigned NOT NULL auto_increment,
	uid int unsigned NOT NULL default '0',
	title varchar(100) NOT NULL default '',
	`type` varchar(6) NOT NULL default '',
	visibility int(1) NOT NULL default '0',
	`fields` text NOT NULL,
	conditions text NOT NULL,
	custom_profile_fields text NOT NULL,
	sortby varchar(20) NOT NULL default '',
	sortorder varchar(4) NOT NULL default '',
	perpage int(4) NOT NULL default '0',
	view_type varchar(6) NOT NULL default '',
	PRIMARY KEY(vid)
) ENGINE=MyISAM;";

The same problem is to be found in mysql improved.

PS: Sorry, if this is the wrong place to post bugs - I havn't found a better one.
Incorrect forum for this. Moved.
What version of MySQL are you using...?? Never had anybody have this problem before.
I have had similar issues with fields named "views" and "type" in my plugins. Rather not give out my version info though.
Field names should be quoted to avoid these problems. I've also seen it happen. Used to be a problem with backups. Not sure it still exists because I recall a bug report that fixed it.

But MyBB should ALWAYS at least single quote the table names and fields to avoid the problems.
(2011-11-07, 08:47 PM)MattRogowski Wrote: [ -> ]What version of MySQL are you using...?? Never had anybody have this problem before.

MySQLi 4.1.22
Your host should seriously upgrade their MySQL installation, or you should find a better host with MySQL 5.
Hope you're not paying for this hosting.