Getting error message:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 7 query: CREATE TABLE user_badges_badges ( bid int(10) NOT NULL default '0', name varchar(50) NOT NULL default '', image varchar(80) NOT NULL default '', weight int(2) NOT NULL default '0', href VARCHAR(80) default '', ) in /var/www/vhosts/REMOVED.org/subdomains/ALSOREMOVED/httpdocs/includes/database.mysql.inc on line 174.

think it was probably :

case 'mysqli':
db_query("CREATE TABLE {user_badges_badges} (
bid int(10) NOT NULL default '0',
name varchar(50) NOT NULL default '',
image varchar(80) NOT NULL default '',
weight int(2) NOT NULL default '0',
href VARCHAR(80) default '',
)");

changed it to

case 'mysqli':
db_query("CREATE TABLE {user_badges_badges} (
bid int(10) NOT NULL default '0',
name varchar(50) NOT NULL default '',
image varchar(80) NOT NULL default '',
weight int(2) NOT NULL default '0',
href VARCHAR(80) default ''
)");

in install file, and it seemed to work after that.

CommentFileSizeAuthor
#4 user_badges.install.txt3.71 KBsnailian

Comments

will kirchheimer’s picture

Status: Active » Needs review

that is I removed the comma at end of : href VARCHAR(80) default '',

chadchandler’s picture

Status: Needs review » Postponed (maintainer needs more info)

user warning: Table 'myname_drpl1.user_badges_badges' doesn't exist query: SELECT DISTINCT b.bid, b.weight, b.name, b.image, b.href FROM user_badges_badges b INNER JOIN user_badges_user u ON b.bid = u.bid WHERE u.uid = 1 ORDER BY b.weight, b.name in /includes/database.mysql.inc on line 172.

Also happens in dev version ... is there a simple fix?

skkd’s picture

same problem here..

user warning: Table 'XXX_drupaldb.user_badges_badges' doesn't exist query: SELECT DISTINCT b.bid, b.weight, b.name, b.image, b.href FROM user_badges_badges b INNER JOIN user_badges_user u ON b.bid = u.bid WHERE u.uid = 181 ORDER BY b.weight, b.name in /home/XXX/domains/arabolge.org/public_html/includes/database.mysql.inc on line 174.

line 174 of database.mysql.inc:

trigger_error(check_plain(mysql_error($active_db) ."\nquery: ". $query), E_USER_WARNING);

any idea?

snailian’s picture

StatusFileSize
new3.71 KB

I have attached an updated user_badges.install file (just remove the .txt extension) and upload it to the proper location. The comma mentioned in the first post is the source of the error.

Disable the module and re enable it and that should fix the problem.

Alternatively, run this code in mysql to create the table.

CREATE TABLE user_badges_badges (
bid int(10) NOT NULL default '0',
name varchar(50) NOT NULL default '',
image varchar(80) NOT NULL default '',
weight int(2) NOT NULL default '0',
href VARCHAR(80) default '')

idontunderstand’s picture

Stray,

Thank you very much. I will give it a try and let you know if it works.

Stray. I uploaded the install file to replace the one in the existing module but i still got the same problem. When you said to put it in the mysql database, where do I actually put it? Thanks for your help again.

Chris

idontunderstand’s picture

fixed, i uninstalled the module and put the new code in that you gave me and it works but now i am trying to figure out how i can attach it to different profiles

idontunderstand’s picture

any luck anyone with this?

xayberoptix’s picture

Thanks for clearing this up. Shouldn't it be included into a new version?

Richard Blackborder’s picture

Status: Postponed (maintainer needs more info) » Fixed

This bug isn't around any more.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.