Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Code To Install Mysql Database Table?
wappy
post 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 ;-)
Go to the top of the page
 
+Quote Post
nehmanator333
post 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
Go to the top of the page
 
+Quote Post
wappy
post 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.
Go to the top of the page
 
+Quote Post
farsiscript
post 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
Go to the top of the page
 
+Quote Post
wappy
post 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 :-)
Go to the top of the page
 
+Quote Post
electron
post 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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Want A Light Or Stripped Down Xp Install?(4)
  2. How To Install Ipb 2.2.1(6)
  3. Simple C File Handling In Action(4)
  4. Need Advice On Setting Up Mysql Database.(4)
  5. Quick Question(10)
  6. Firefox And Ie: Table Layouts Look Different In Us!(3)
  7. Video Play Like Youtube(3)
  8. Mysql Database Size(7)
  9. Mysql Hacks(1)
  10. Database Normalization(0)
  11. Smart Install Maker(9)
  12. How do you test your php code(80)
  13. Import From Excel File Into Mysql Database(11)
  14. Davinci Code(5)
  15. Creating A Php Login System Using Mysql(10)
  1. Install Two Anti-virus Software In 1 System(37)
  2. An Uncrackable Code!(2)
  3. How To Use A Database For Chess Results?(0)
  4. Add Flashing Inbox To Invisionfree Forum(2)
  5. I Have Install Windows 2003 Server(5)
  6. Virtual Pc 7 For Mac(11)
  7. Mysql Database Not Working(3)
  8. Create Dynamic Html/php Pages Using Simple Vb.net Code(1)
  9. Ips Installer Database Details [resolved](6)
  10. How To Install Sql Server Express In Package Deployment With Different Instance Name(0)
  11. Mysql Database Setup : Setting Up Mysql Database(6)
  12. The Only Reason I Choose Ms Sql Server Rather Than Mysql(0)
  13. How To Install An Application As A Service(6)
  14. Connect To Remote Oracle Database With Toad(7)
  15. Mysql Db Is Down Getting Following Error(2)


 



- Lo-Fi Version Time is now: 7th October 2008 - 09:37 PM