Hightower Posted December 11, 2008 Posted December 11, 2008 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?
webman Posted December 11, 2008 Posted December 11, 2008 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.
Hightower Posted December 11, 2008 Author Posted December 11, 2008 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.
Hightower Posted December 11, 2008 Author Posted December 11, 2008 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: $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;"; I have tried these also for the last line: `username` varchar(30) NOT NULL"; `username` varchar(30) NOT NULL,";
RabbieBurns Posted December 11, 2008 Posted December 11, 2008 total guess in the dark `username` varchar(30) NOT NULL;"
Hightower Posted December 11, 2008 Author Posted December 11, 2008 total guess in the dark `username` varchar(30) NOT NULL;" Sorry - tried that too
RabbieBurns Posted December 11, 2008 Posted December 11, 2008 do you need to put a ) in there somewhere? 1
Hightower Posted December 11, 2008 Author Posted December 11, 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
Hightower Posted December 11, 2008 Author Posted December 11, 2008 /\ Got it - forgot to set a column as the primary key - now its working cheers!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now