News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Can you help me turn this into a query for phpMyAdmin

Started by Ertado, April 04, 2007, 01:58:45 AM

Previous topic - Next topic

Ertado

I can't use the install script for the invite mod and I want to alter the database through phpMyAdmin. Here is the content of the install script:

<?php

if (!defined('SMF'))
die('Hacking attempt...');

db_query("CREATE TABLE IF NOT EXISTS {$db_prefix}invites (
 ID_INVITE mediumint(8) unsigned NOT NULL auto_increment,
 ID_MEMBER mediumint(8) unsigned NOT NULL default '0',
 ID_REGISTRATION mediumint(8) unsigned NOT NULL default '0',
 inviteTime int(10) unsigned NOT NULL default '0',
 inviteKey varchar(64) character set utf8 NOT NULL default '',
 PRIMARY KEY  (ID_INVITE),
 KEY ID_MEMBER (ID_MEMBER),
 KEY inviteTime (inviteTime),
 KEY inviteKey (inviteKey)
)"
, __FILE__, __LINE__);



$request = db_query("
SHOW COLUMNS
FROM
{$db_prefix}invites
"
, __FILE__, __LINE__);

$columns = array();
while (
$row = mysql_fetch_assoc($request))
$columns[] = $row['Field'];

if (!
in_array('inviteEmail', $columns))
db_query("ALTER TABLE {$db_prefix}invites ADD inviteEmail TINYTEXT NOT NULL", __FILE__, __LINE__);

?>


How do I make this into a query to put into phpMyAdmin? My phpMyAdmin version is 2.8.2 and my MySQL version is 4.1.20.

Kindred

#1
CREATE TABLE IF NOT EXISTS smf_invites (
  ID_INVITE mediumint(8) unsigned NOT NULL auto_increment,
  ID_MEMBER mediumint(8) unsigned NOT NULL default '0',
  ID_REGISTRATION mediumint(8) unsigned NOT NULL default '0',
  inviteTime int(10) unsigned NOT NULL default '0',
  inviteKey varchar(64) character set utf8 NOT NULL default '',
  PRIMARY KEY  (ID_INVITE),
  KEY ID_MEMBER (ID_MEMBER),
  KEY inviteTime (inviteTime),
  KEY inviteKey (inviteKey)
);


-edit- damned auto-smiley parser...   :P
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Harro

But without the smilies ;)
Also you have to replace smf_ with the prefix you are using.
But smf_ is the default, so if you didn't change it should work fin.


CREATE TABLE IF NOT EXISTS smf_invites (
  ID_INVITE mediumint(8) unsigned NOT NULL auto_increment,
  ID_MEMBER mediumint(8) unsigned NOT NULL default '0',
  ID_REGISTRATION mediumint(8) unsigned NOT NULL default '0',
  inviteTime int(10) unsigned NOT NULL default '0',
  inviteKey varchar(64) character set utf8 NOT NULL default '',
  PRIMARY KEY  (ID_INVITE),
  KEY ID_MEMBER (ID_MEMBER),
  KEY inviteTime (inviteTime),
  KEY inviteKey (inviteKey)
);

Advertisement: