Raised This Month: $ Target: $400
 0% 

SQL Database query, make db if not there...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ThantiK
Senior Member
Join Date: Mar 2004
Location: Orlando, FL
Old 09-23-2004 , 04:58   SQL Database query, make db if not there...
Reply With Quote #1

Would someone mind throwing me some examples of accessing a database and table...checking if they exist, and if they dont exist, create them and the necessary fields?

I already have the database ACCESS, writing, etc all down, but am somewhat stumped on how to tell if a database exists before accessing, and creating these things if they dont exist.
__________________
AMXX -- You want control? You got it.
tkwired.com cs 1.6 -- tkwired.com:27016
ThantiK is offline
Send a message via AIM to ThantiK Send a message via MSN to ThantiK
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 09-23-2004 , 08:32  
Reply With Quote #2

here is a create if not exists...

format (mquery, 511, "CREATE TABLE IF NOT EXISTS `%s` ( `playerid` VARCHAR(35) NOT NULL, `playername` VARCHAR(35) NOT NULL, `xp` INT(11) NOT NULL, `race` TINYINT(4) NOT NULL, `skill1` TINYINT(4), `skill2` TINYINT(4), `skill3` TINYINT(4), `skill4` TINYINT(4), `time` TIMESTAMP( 14 ) NOT NULL, PRIMARY KEY (playerid,race))",mysqltablename)
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:20.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode