I'm looking at creating an installer for a project I'm working on in PHP (like you would see when installing Moodle/Joomla - only mine will be a bit simpler.
Any good tutorials?

I'm looking at creating an installer for a project I'm working on in PHP (like you would see when installing Moodle/Joomla - only mine will be a bit simpler.
Any good tutorials?

The installer will largely be dependant on what your projects requirements are for it to be come ready-to-use. Eg. set file permissions? Install database tables? Write stuff to a file? And how many of these there are (single page with a few fields, or multi-page?)
One page is easy - just have a form with the fields you need and have it submit to a page (it can be the same page..) that carries out actions based on those fields. Multi-page is similar, but you need to add control to: a) store the form input from one stage to the next (sessions?) and b) load (include) different form fields depending on the stage chosen. The stage can be as easy as setting a hidden form field.

At this moment I think I'll just be looking to start at the start and make the installation a single page - sounds like the easiest. The things I want it to do are:
Set a config.php file with settings such as:
db settings
user settings
ldap settings
so that these are all set in one place by using the installer.
I would then like to call these settings when needed to be used in other pages.
Another thing the installer should do is install the database based on the entered settings.
Any help/links to good tutorials would be great.

My script is getting there but when I try to create a table within the script I get this:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 8
Here is my MySQL syntax:
I have tried these also for the last line:Code:$sql = "CREATE TABLE `sites` ( `id` int(11) NOT NULL auto_increment, `date_added` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `title` varchar(300) NOT NULL, `address` varchar(300) NOT NULL, `subject` varchar(20) NOT NULL, `reason` varchar(300) NOT NULL, `username` varchar(30) NOT NULL;";
Code:`username` varchar(30) NOT NULL";Code:`username` varchar(30) NOT NULL,";

total guess in the dark
Code:`username` varchar(30) NOT NULL;"

do you need to put ain there somewhere?Code:)
Hightower (11th December 2008)

You have a ( but no ) on line 8
Hightower (11th December 2008)

Thanks - school boy error!
Now I get this error though
Incorrect table definition; there can be only one auto column and it must be defined as a key

/\ Got it - forgot to set a column as the primary key - now its working cheers!
There are currently 1 users browsing this thread. (0 members and 1 guests)