<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ZeroComShop installation!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<font face="Verdana, Arial" size="2" color="#000000">
<font color='#ff0000'>Have you setup the file ADMIN/CONFIG.PHP correctly?</font>
<br>
<br><a href="install.php?act=db_sure">START!</a>
<br>
<br>
<?php
$pagename = "install";
include "db_connect.php";
include "admin/config.php";
if($act==db_sure) { ?>
Database maken
<br><font color='#ff0000'>NOTICE AN OLD DATABASE WITH THIS NAME WILL BE LOST</font>
<br>
<br><a href='install.php?act=db'>continue</a>.
<?php
}//end db_sure
if($act==db) {
echo "Creating database (step 1/3)";
mysql_drop_db("$database");
mysql_create_db("$database") or die("<br><br>Error creating database: ". mysql_error());
echo "
<br><br>Database created.
<br><a href='install.php?act=tables'>continue</a>.
";
}//end db
if($act==tables) {
echo "<br><br>Create tables(step 2/3)";
$nieuwsbrief_create = 'CREATE TABLE newsletter (id int(11) NOT NULL auto_increment, date varchar(40) NOT NULL, name varchar(40) NOT NULL, email varchar(40) NOT NULL)';
$producten_create = 'CREATE TABLE product (id tinyint(1) NOT NULL, articlename varchar(100), description blob, orderno varchar(30), price varchar(12))';
$admin_create = 'CREATE TABLE admin (username varchar(30), password varchar(30))';
mysql_query($nieuwsbrief_create) or die("<br>Error creating table: nieuwsbrief ". mysql_error());
mysql_query($producten_create) or die("<br>Error creating table: producten ". mysql_error());
mysql_query($admin_create) or die("<br>Error creating table: admin ". mysql_error());
echo "
<br><br>Tables created.
<br><a href='install.php?act=create_admin'>continue</a>.
";
}//end tables
if($act==create_admin) {
echo "<br><br>Create administrator account (step 3/3)";
$test_admin = "INSERT INTO admin (username, password) VALUES ('admin', '1234')";
mysql_query($test_admin) or die("<br><br>Error creating administrator account: ". mysql_error());
echo "
<br><br>Admin created.
<br><a href='install.php?act=finish'>continue</a>.
";
}//end create_admin
if($act==finish) { ?>
Installation done
<br>
<br>U can log in with: admin/1234.
<br>It is highly recommended that you change the admin user and/or pass!!!
<br>
<br>Log in now? <a href='admin/index.php'>click</a>.
<br>Or to the <a href='shop.php'>mainpage</a>.
<?php
}//end finish
?>
</font>
</body>
</html>
I have this code, it basically creates a DB, some tables and a admin user for an Admin area. (IF IT WORKS)
The problem is in:
$nieuwsbrief_create = 'CREATE TABLE newsletter (id int(11) NOT NULL auto_increment, date varchar(40) NOT NULL, name varchar(40) NOT NULL, email varchar(40) NOT NULL)';
$producten_create = 'CREATE TABLE product (id tinyint(1) NOT NULL, articlename varchar(100), description blob, orderno varchar(30), price varchar(12))';
$admin_create = 'CREATE TABLE admin (username varchar(30), password varchar(30))';
mysql_query($nieuwsbrief_create) or die("<br>Error creating table: nieuwsbrief ". mysql_error());
mysql_query($producten_create) or die("<br>Error creating table: producten ". mysql_error());
mysql_query($admin_create) or die("<br>Error creating table: admin ". mysql_error());
It keeps on returning that there is no database selected.... Anyone got a idea? i think my query is wrong somewhere but i dont know and cannot find how it must be done... i checked with some other file and it seems ok... but still it gives me crap!
The '1st' step of the installation (where the DB is created) works fine, so the db_connect.php is included properly and works i guess 🙂
Anyone got a clue?