IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Reply to this topicStart new topic

Code To Install Mysql Database Table?


wappy
no avatar
Premium Member
********
Group: Members
Posts: 164
Joined: 2-July 06
From: England
Member No.: 25,974



Post #1 post Jul 7 2006, 11:50 PM
Can anyone show me example code of how to install a database table instead of me having to upload an file with it in, so i can do it from a php page? Thanks in advance ;-)
Go to the top of the page
+Quote Post
nehmanator333
no avatar
Newbie [Level 2]
**
Group: Members
Posts: 30
Joined: 8-July 06
Member No.: 26,279



Post #2 post Jul 8 2006, 03:39 AM
google.com
Go to the top of the page
+Quote Post
wappy
no avatar
Premium Member
********
Group: Members
Posts: 164
Joined: 2-July 06
From: England
Member No.: 25,974



Post #3 post Jul 11 2006, 10:16 AM
But i don't want to search google? I use this site and post my code snippets here, also i know for a fact someone here can help me with this.. What is the use in searching google when we can build a nice database of code and php help here? If i find the code before anyone replys with it i will post it here anyhow as it may be usefull to other users here.
Go to the top of the page
+Quote Post
farsiscript
no avatar
Super Member
*********
Group: Members
Posts: 357
Joined: 8-April 06
Member No.: 21,487



Post #4 post Jul 11 2006, 12:16 PM
Hi
If You want Make install.php for your Script do this :
at first make config.php file with this codes :
CODE
<?php
mysql_connect("localhost","Database Username","Database Password") or die(mysql_error());
mysql_select_db("Database Name") or die(mysql_error());
?>

and then For Create tables in your database paste this code in install.php file :

CODE

include ("config.php");
mysql_query("
CREATE TABLE news (
id tinyint(4) NOT NULL auto_increment,
text text NOT NULL,
sub text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM; ");


With this code You create news tables in your Database
Tables news has 2 column ( Text and sub)
if you want make more column look at this query :
CODE

include ("config.php");
mysql_query("
CREATE TABLE news (
id tinyint(4) NOT NULL auto_increment,
text text NOT NULL,
sub text NOT NULL,
time text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM; ");

at this query we add new column (time) to tabel
at end save install.php file and when you browse install.php in your browser your databse and tables are creat
Go to the top of the page
+Quote Post
wappy
no avatar
Premium Member
********
Group: Members
Posts: 164
Joined: 2-July 06
From: England
Member No.: 25,974



Post #5 post Jul 17 2006, 07:21 AM
thanks alot, that is exactly what i was looking for :-) i can finish my script now, thanks again :-)
Go to the top of the page
+Quote Post
electron
no avatar
Premium Member
********
Group: Members
Posts: 162
Joined: 10-May 06
Member No.: 23,375
myCENT:35.86



Post #6 post Jul 18 2006, 06:38 AM
What script are you making may i know.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   3 -Sky- 623 12th June 2009 - 08:48 PM
Last post by: -Sky-
No New Posts   0 akira550 177 19th September 2009 - 06:27 AM
Last post by: akira550
No New Posts   13 chinfo 8,703 2nd August 2004 - 03:12 AM
Last post by: X3r0X
No New Posts 3 chalawanonline 6,269 2nd August 2004 - 02:34 PM
Last post by: Spectre
No New Posts 7 odomike 18,941 30th April 2008 - 02:44 PM
Last post by: FeedBacker
No new   97 Xenon 47,149 29th October 2009 - 04:25 PM
Last post by: magiccode9
No New Posts   7 SilverBoarder 14,231 9th February 2009 - 11:02 AM
Last post by: aloKNsh
No New Posts   11 bttfpromo 11,507 14th September 2004 - 08:55 PM
Last post by: Magic-Node
No New Posts   11 Raptrex 6,782 13th October 2004 - 07:26 PM
Last post by: odomike
No New Posts   2 threepach 2,089 19th February 2008 - 08:30 PM
Last post by: threepach
No New Posts   7 Raptrex 13,184 27th August 2004 - 11:16 PM
Last post by: Spectre
No New Posts 4 NuHoaXuLa 6,230 29th August 2004 - 03:12 AM
Last post by: NuHoaXuLa
No New Posts   11 Triple X 6,338 5th September 2004 - 02:33 AM
Last post by: Triple X
No New Posts   4 Schweden 4,966 8th September 2004 - 09:40 AM
Last post by: Schweden
No New Posts   2 wassie 4,678 10th September 2004 - 11:00 PM
Last post by: Seņor Maniac


 



RSS Open Discussion Time is now: 6th November 2009 - 06:54 AM

Web Hosting Powered by ComputingHost.com.