creating tables only once

This is a discussion on "creating tables only once" within the Databases section. This forum, and the thread "creating tables only once are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Mar 1st, 2008, 00:52
Junior Member
Join Date: Feb 2008
Location: U.S.A
Age: 26
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
creating tables only once

so i was just experimenting with a free web account with mysql databases, and i noticed that the "CREATE TABLE ... " thing only has to be done once, which makes sense, but if I want to do it only once, should i just load a file that does it, then take down that file? thanks guys.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Mar 1st, 2008, 08:31
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,402
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: creating tables only once

If you upload a file which says 'CREATE TABLE example...'
And then navigate to it, as long as your code is right, it will create the table.

But you would use php to do that.
PHP: Select all

$sql mysql_query("CREATE TABLE example...");
if (
$sql) {
echo 
'Done'
} else {
echo 
'Error';

Remembering that you would need to be connected to the database first

If you were then to navigate to that file again, it would give an error because the table already exists. MySQL will not overwrite if the table already exists.

Jack
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Mar 1st, 2008, 11:51
Junior Member
Join Date: Sep 2007
Location: uk
Age: 32
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Re: creating tables only once

I would use phpMyAdmin for creating tables, most webhosts provide this software if you have MySQL enabled in your account. It makes it very quick and easy to set up all your tables and you can also view and edit table entries if you want as well.

If you have a file that contains all the table information you can import this in to phpMyAdmin and it will create all the tables for you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Mar 1st, 2008, 21:09
Junior Member
Join Date: Feb 2008
Location: U.S.A
Age: 26
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Re: creating tables only once

okay thanks guys thats basically all i needed to know- i think i will just run a script that sets up all my tables like once then remove it. thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Mar 1st, 2008, 21:10
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,402
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: creating tables only once

Quote:
Originally Posted by kerrsmith View Post
I would use phpMyAdmin for creating tables, most webhosts provide this software if you have MySQL enabled in your account. It makes it very quick and easy to set up all your tables and you can also view and edit table entries if you want as well.

If you have a file that contains all the table information you can import this in to phpMyAdmin and it will create all the tables for you.
You can also create the tables in that and then ask it to create the required PHP code, which is handy
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Mar 5th, 2008, 14:01
Junior Member
Join Date: Feb 2008
Location: U.S.A
Age: 26
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Re: creating tables only once

okay, bigger problem now. i cannot find a free host w/ php and mysql that actually works! two of them that i have used- gigacities and one other, i forget- refuse to save my stuff without having an error, and when it does save the source code, it changes it! it deletes all of the php, as well as the starting html ,body and other important tags, so nothing ends up showing up! how to fix? thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
omg keep me away from tables !!! HELP!!! bruno89 Web Page Design 5 Jul 1st, 2007 18:33
Why are tables bad? WebNinja Web Page Design 17 Jan 31st, 2007 21:31
No more tables? PicoDeath Web Page Design 9 Sep 28th, 2006 18:03
Tables or CSS? bee_bo Web Page Design 15 Jul 6th, 2006 08:32
Tables... dhagsjash Web Page Design 2 Sep 16th, 2003 09:05


All times are GMT. The time now is 04:04.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42