Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Help please

  1. #1
    New to the CF scene
    Join Date
    Nov 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Help please

    Im having a problem with my install.php which the code for it is at the bottom. Everything is working on it except that it isnt doing this part

    PHP Code:
    mysql_query("INSERT INTO `config` (`name`, `value`, `desc`) VALUES
        ('admin_username', '"
    .$admin_username."', ''),
        ('admin_password', '"
    .md5($admin_password)."', ''),
        ('thumb_width', '200', 'The width of a thumbnail in px (pixels).'),
        ('thumb_height', '200', 'The height of a thumbnail in px (pixels).'),
        ('show_html', '1', 'Whether HTML should be filtered or not in descriptions, titles etc. (Note: Only use this if you know what you are doing otherwise you may mess up the layout)'),
        ('per_page', '3', 'The number of projects to show per page.'),
        ('title', '"
    .$title."', 'The title of your portfolio/site.'),
        ('about', 'Fill this in yourself.', 'The text on the about page.'),
        ('email', '"
    .$email."', 'The email to receive the messages from the contact page.');"); 

    install.php
    PHP Code:
    <?php
    $install_page 
    1;
    require(
    'config.php');

    // installer
    // fill in the data and run this script


    // EDIT DATA BELOW

    // enter the username for the admin control panel
    $admin_username 'admin';

    // enter the password for the admin control panel
    $admin_password 'password';

    // enter the title of the portfolio (this can be changed in the admin panel after installation)
    // if the title has quotes in it (' or ") then put a \ infront of them.
    // e.g. Bob's Photoshop Portfolio should be Bob\'s Photoshop Portfolio (although you will not see the \)
    $title 'Portfolio';

    // enter the email to receive the messages from the contact form (this can be changed after)
    $email 'myemail@email.com';



    // NO MORE EDITING REQUIRED


    global $mysql_db;
    if(
    mysql_num_rows(mysql_query("SHOW TABLES FROM ".$mysql_db)) == 0) {
        
    mysql_query('CREATE TABLE IF NOT EXISTS `projects` (
          `id` int(11) NOT NULL auto_increment,
          `title` varchar(40) NOT NULL,
          `desc` text NOT NULL,
          `url` text NOT NULL,
          PRIMARY KEY  (`id`)
        ) ENGINE=MyISAM  DEFAULT CHARSET=latin1'
    );
        
        
    mysql_query('CREATE TABLE IF NOT EXISTS `config` (
          `name` varchar(20) NOT NULL,
          `value` text NOT NULL,
          `desc` text NOT NULL
        ) ENGINE=MyISAM DEFAULT CHARSET=latin1;'
    );
        
        
        
    mysql_query("INSERT INTO `config` (`name`, `value`, `desc`) VALUES
        ('admin_username', '"
    .$admin_username."', ''),
        ('admin_password', '"
    .md5($admin_password)."', ''),
        ('thumb_width', '200', 'The width of a thumbnail in px (pixels).'),
        ('thumb_height', '200', 'The height of a thumbnail in px (pixels).'),
        ('show_html', '1', 'Whether HTML should be filtered or not in descriptions, titles etc. (Note: Only use this if you know what you are doing otherwise you may mess up the layout)'),
        ('per_page', '3', 'The number of projects to show per page.'),
        ('title', '"
    .$title."', 'The title of your portfolio/site.'),
        ('about', 'Fill this in yourself.', 'The text on the about page.'),
        ('email', '"
    .$email."', 'The email to receive the messages from the contact page.');");
        echo 
    'The script is now installed, you can delete this file (install.php) now.';
    }else{
        echo 
    'The script has already been installed, delete this file (install.php) now.';
    }

    ?>
    Last edited by Th3Boss; 11-26-2009 at 01:17 PM.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    Add proper error checks to your query, to reveal the errors in it, like
    Code:
    mysql_query(... your query here...) or die(mysql_error());
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Nov 2009
    Location
    Hamilton, New Zealand
    Posts
    126
    Thanks
    0
    Thanked 17 Times in 17 Posts
    Firstly, you are only declaring to set 3 columns, name, value and desc.

    Secondly, you are trying to set the values to..... something really weird?

    I am making an assumption here, but maybe you are wanting to do:

    PHP Code:
    mysql_query("INSERT INTO 'config' ('admin_username', 'admin_password','thumb_width','thumb_height', 'show_html', 'per_page', 'title', 'about', 'email') VALUES
        ('"
    .$admin_username."', '".md5($admin_password)."','200', '200', '1','3', '".$title."', 'Fill this in yourself.', '".$email."')"); 

  • #4
    New to the CF scene
    Join Date
    Nov 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok got everything working, thanks


  •  

    Posting Permissions

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