PDA

View Full Version : My sql Help


Sik Micz Tech
03-15-2005, 01:50 PM
ok i can usually get this stuff to work right. but i need ot convert a Automoatic database installer to a Manual one ao i can add in teh table manualy. i have pasted the code below so if any one can help me convert this to manual. any help on this will be great.




// ######################### Run Queries #######################
if ($step == 'doqueries')
{
$DB_site->query("CREATE TABLE " . TABLE_PREFIX . "award (
awardid smallint(5) unsigned NOT NULL auto_increment,
name varchar(50) NOT NULL default '',
description varchar(250) NOT NULL default '',
icon_url varchar(250) NOT NULL default '',
PRIMARY KEY (awardid)
) TYPE=MyISAM;
");

$DB_site->query("CREATE TABLE " . TABLE_PREFIX . "useraward (
userid int(10) NOT NULL auto_increment,
PRIMARY KEY (userid)
) TYPE=MyISAM;
");

// FIX EMPTY USER AWARD TABLE
$users = $DB_site->query("
SELECT user.userid
FROM " . TABLE_PREFIX . "user AS user
LEFT JOIN " . TABLE_PREFIX . "useraward AS useraward USING(userid)
WHERE useraward.userid IS NULL
");

$userids = array();
while ($user = $DB_site->fetch_array($users))
{
$userids[] = $user['userid'];
}

if (!empty($userids))
{
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "useraward (userid) VALUES (" . implode('),(', $userids) . ")");
}

echo "<br />Queries Run!<br /><br />";

echo "<a href=\"awards_install.php?step=dofileedits\"><b>Click here to continue to step 4 --&gt;</b></a><br /><br />\n";
}

Jolten
03-15-2005, 05:28 PM
You need to just do it manually? Copy and paste the query into phpmyadmin and run it. Or did you need a manual installer version of this hack?

Sik Micz Tech
03-16-2005, 11:09 AM
i need that coding made so i can have amanual installer for it. some one delete the Databases that those make and now the VB wont run. iso i need ot make the Database ASAP.