PDA

View Full Version : MYSQL INSTALL



chrisgocrazyH
05-01-2008, 04:42 PM
hello im learning mysql and i want to know how would i make this into install.php so u dont have to manually install


CREATE TABLE `uploads` (
`id` int(10) unsigned NOT NULL auto_increment,
`whenuploaded` datetime NOT NULL default '0000-00-00 00:00:00',
`ipaddress` varchar(15) NOT NULL default 'unknown',
`imageloc` varchar(255) NOT NULL default 'unknown',
`imagesize` int(10) unsigned default NULL,
`imagetype` varchar(30) default NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM;

what would be install.php

Moved by Agesilaus (Forum Moderator) from Designing and Development: Please post in the correct forum next time. :)

Forge
05-01-2008, 04:44 PM
just add some code that connects to a database and then make that a quiery..

Blob
05-01-2008, 07:05 PM
Do it in phpMyAdmin and then click on the bit that says "Create PHP code"

chrisgocrazyH
05-01-2008, 11:37 PM
ty blob will do :)

Hitman
06-01-2008, 12:20 AM
Or...



<?
include 'config.php'; // include some kind of connection

$install = mysql_query("CREATE TABLE `uploads` (
`id` int(10) unsigned NOT NULL auto_increment,
`whenuploaded` datetime NOT NULL default '0000-00-00 00:00:00',
`ipaddress` varchar(15) NOT NULL default 'unknown',
`imageloc` varchar(255) NOT NULL default 'unknown',
`imagesize` int(10) unsigned default NULL,
`imagetype` varchar(30) default NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM;") or die("Error: " . mysql_error());;
echo "Installed...";
?>

Remember, make a file called config.php and put a connection, or just connect on that page...

Want to hide these adverts? Register an account for free!