Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-26-2009, 12:26 PM   PM User | #1
Th3Boss
New to the CF scene

 
Join Date: Nov 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Th3Boss is an unknown quantity at this point
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..
Th3Boss is offline   Reply With Quote
Old 11-26-2009, 12:57 PM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Add proper error checks to your query, to reveal the errors in it, like
Code:
mysql_query(... your query here...) or die(mysql_error());
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 11-26-2009, 01:07 PM   PM User | #3
Rebbu
Regular Coder

 
Join Date: Nov 2009
Location: Hamilton, New Zealand
Posts: 126
Thanks: 0
Thanked 17 Times in 17 Posts
Rebbu is on a distinguished road
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."')"); 
Rebbu is offline   Reply With Quote
Old 11-26-2009, 01:17 PM   PM User | #4
Th3Boss
New to the CF scene

 
Join Date: Nov 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Th3Boss is an unknown quantity at this point
ok got everything working, thanks
Th3Boss is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:08 PM.


Advertisement
Log in to turn off these ads.