+ Post New Thread
Results 1 to 10 of 10
Coding Thread, config.php in Coding and Web Development; I'm looking at creating an installer for a project I'm working on in PHP (like you would see when installing ...
  1. #1

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    242

    config.php

    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?

  2. #2

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,422
    Thank Post
    645
    Thanked 967 Times in 667 Posts
    Blog Entries
    2
    Rep Power
    328
    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.

  3. #3

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    242
    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.

  4. #4

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    242
    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:

    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;";
    I have tried these also for the last line:

    Code:
    `username` varchar(30) NOT NULL";
    Code:
    `username` varchar(30) NOT NULL,";

  5. #5

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,532
    Thank Post
    1,341
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    total guess in the dark

    Code:
    `username` varchar(30) NOT NULL;"

  6. #6

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    242
    Quote Originally Posted by RabbieBurns View Post
    total guess in the dark

    Code:
    `username` varchar(30) NOT NULL;"
    Sorry - tried that too

  7. #7

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,532
    Thank Post
    1,341
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    do you need to put a
    Code:
    )
    in there somewhere?

  8. Thanks to RabbieBurns from:

    Hightower (11th December 2008)

  9. #8

    CESIL's Avatar
    Join Date
    Nov 2006
    Location
    Hampshire
    Posts
    1,405
    Thank Post
    109
    Thanked 267 Times in 198 Posts
    Rep Power
    169
    You have a ( but no ) on line 8

  10. Thanks to CESIL from:

    Hightower (11th December 2008)

  11. #9

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    242
    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

  12. #10

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    242
    /\ Got it - forgot to set a column as the primary key - now its working cheers!



SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 20
    Last Post: 30th April 2012, 02:26 PM
  2. My PHP config file - please ignore
    By monkey_boy in forum Other Stuff
    Replies: 0
    Last Post: 24th April 2007, 12:29 PM
  3. MRBS Config Files
    By Joedetic in forum Web Development
    Replies: 0
    Last Post: 28th June 2006, 12:54 PM
  4. Using PXES Config
    By adamyoung in forum Thin Client and Virtual Machines
    Replies: 2
    Last Post: 25th May 2006, 10:33 AM
  5. Samba config
    By Dos_Box in forum *nix
    Replies: 7
    Last Post: 19th October 2005, 10:21 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •