PDA

View Full Version : Confused about this query


HMBeaty
07-09-2011, 12:20 AM
Hello again :D

So, I'm finally starting to learn how to add custom usergroup permissions, and have been somewhat successful (I think), however, in the install code for my modification, I first tried:
$db->hide_errors();

$db->query_write("ALTER TABLE " . TABLE_PREFIX . "usergroup
ADD usmlsaperms int(10) unsigned NOT NULL default '0',
ADD staffappminpostreq int(10) NOT NULL default '100',
ADD staffappminrepreq int(10) NOT NULL default '100',
ADD staffappminregreq int(10) NOT NULL default '100'
");

$db->show_errors();
...which didn't work. So, I went the long way and tried:
$db->hide_errors();

$db->query_write("ALTER TABLE " . TABLE_PREFIX . "usergroup
ADD usmlsaperms int(10) unsigned NOT NULL default '0'
");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "usergroup
ADD staffappminpostreq int(10) NOT NULL default '100'
");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "usergroup
ADD staffappminrepreq int(10) NOT NULL default '100'
");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "usergroup
ADD staffappminregreq int(10) NOT NULL default '100'
");

$db->show_errors();
....which seems to work so far.

So, my question is, why didn't the first code work? :confused:

LifesGreatestGift
07-09-2011, 01:23 AM
maybe this

$db->query_write("ALTER TABLE " . TABLE_PREFIX . "usergroup ADD
(usmlsaperms int(10) unsigned NOT NULL default '0',
staffappminpostreq int(10) NOT NULL default '100',
staffappminrepreq int(10) NOT NULL default '100',
staffappminregreq int(10) NOT NULL default '100')
");