PDA

View Full Version : aaaggghhh!


Creative Insanity
10-28-2005, 09:18 PM
I have hit a brick wall.
I have found the need to create a site installer which also creates the database tables and for some reason it is not working.
I have an empty database and I am trying to create a table with a few test feilds but not working.. could someone shed some light on this please.

<?php require_once('../Connections/installer.php');
mysql_select_db($database_installer, $installer);
$query_installer = "CREATE TABLE `about` (
`ID` mediumint(10) NOT NULL auto_increment,
`txt` text NOT NULL,
PRIMARY KEY (`ID`)
) TYPE=MyISAM AUTO_INCREMENT=1";
?>
what is wrong here?

Ta muchly

Oh BTW I have never done this type of stuff before incase you are wondering :)

kate
10-29-2005, 06:59 AM
Hya CI,

Myself I am not good with code yet but my moderator is. I have yet to put questions to him he can't find a way round. if you don't get sorted register and ask at his forums.

By trade he is a chemist and so must know about matamatics etc and he does have a PHP, mysqual forums.

http://umm-pur.com/forum/index.php?showforum=12 ('http://umm-pur.com/forum/index.php?showforum=12')

I am condfident he can help you solve your problem.

;)

Creative Insanity
10-29-2005, 09:16 AM
Thanks kate.. I don't think I will join though as it is too restrictive (have to login to use the search).

It is ok now anyway as I have sussed it our :)
It was my connection script that was causing the problem, so included that also in the install file and worked a treat :)

<?php

$dbserver = "localhost"; //MySQL server (localhost whould be correct)
$dbuser = "user"; // MySQL user name
$dbpass = "pass"; // User password
$dbname = "db"; // database name


$db = mysql_connect($dbserver,$dbuser,$dbpass) or die("Failed to cennect to mysql server");
if(mysql_select_db($dbname)==false) { mysql_close($db); die("Failed to select database"); }

mysql_query("
CREATE TABLE about (
`ID` mediumint(10) NOT NULL auto_increment,
`title` text NOT NULL,
`txt` text NOT NULL,
PRIMARY KEY (`ID`)
);
") or die("Unable to create table".mysql_error());
mysql_close($db);
?>

kate
10-29-2005, 11:29 AM
Ok CI,

Well done.

;)