how to make an install script

Codes here !

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 8
Joined: Thu Jan 02, 2003 2:28 pm

how to make an install script

Postby ceetee » Sun Jun 22, 2003 6:13 am

I've just finished making a content management system and want a script to install the tables and insert the provisional pass/username. On my first attempt I used the mysql_query () for each create table. This worked fine except err.. the prefix of each table e.g esm_writer_permissions had turned into ESM_writer_permissions. And some tables refused insert commands. I ended up having to paste the SQL into the phpMyAdmin directly.

This isn't a big deal for me but for some users it would. Is there some way of doing it by php instead?

User avatar
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens

Postby mike » Sun Jun 22, 2003 4:00 pm

Have a look on mysql_ functions. You can create tables and insert your pre-configured data inside. Assume that users should first have a database with a valid user/pass.

New php-forum User
New php-forum User
Posts: 11
Joined: Wed Jun 25, 2003 5:07 am

Postby elToro » Thu Jun 26, 2003 11:32 am

You might try looking at some free/Open Source PHP/MySQL apps that use install scripts. phpBB ( comes to mind. Just download it and then look at the code for its install script.

New php-forum User
New php-forum User
Posts: 4
Joined: Fri Jun 27, 2003 10:05 am

Postby Pezzoni » Sun Jun 29, 2003 12:11 pm

hi, the way I've done it is by creating 3 files:
install.php - A simple Form that takes relavant infomation
do_install.php - Takes the infomation from the form, assigns them to variables, then creates a config file based around the variables.
create_databse.php - Using the newly created config file, makes and populates the database fields.

Hope that helps


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 4 guests