|
|
|
|
![]() ![]() |
Jul 7 2006, 11:50 PM
Post
#1
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 164 Joined: 2-July 06 From: England Member No.: 25,974 |
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 ;-)
|
|
|
|
Jul 8 2006, 03:39 AM
Post
#2
|
|
|
Newbie [Level 2] ![]() ![]() Group: Members Posts: 30 Joined: 8-July 06 Member No.: 26,279 |
google.com
|
|
|
|
Jul 11 2006, 10:16 AM
Post
#3
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 164 Joined: 2-July 06 From: England Member No.: 25,974 |
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.
|
|
|
|
Jul 11 2006, 12:16 PM
Post
#4
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 357 Joined: 8-April 06 Member No.: 21,487 |
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 |
|
|
|
Jul 17 2006, 07:21 AM
Post
#5
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 164 Joined: 2-July 06 From: England Member No.: 25,974 |
thanks alot, that is exactly what i was looking for :-) i can finish my script now, thanks again :-)
|
|
|
|
Jul 18 2006, 06:38 AM
Post
#6
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 162 Joined: 10-May 06 Member No.: 23,375 |
What script are you making may i know.
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 7th October 2008 - 09:37 PM |