PLS HELP! Having trouble with config.php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
valeen10
Forum Newbie
Posts: 6
Joined: Fri Jan 22, 2010 8:16 pm

PLS HELP! Having trouble with config.php

Post by valeen10 »

I truly need help with this config.php file. Been trying to figure it out for days now :banghead: but no luck and no tutorial online to give some insight on what I should do.

I have some PHP knowledge and HTML knowledge but need some guidance in mysql.

Below is the section on the config.php I'm having trouble with...the trouble area is in red

$dbhost = 'mysql'; // database host
(is username and password for myphpadmin?)
$dbuser = 'whisper@localhost'; // database user name
$dbpass = '*******'; // database user password

$dbdatabase = 'ecards'; // database with Cards tables

To give you an idea of what I've done so far, I installed MyPHPAdmin in the actual file folder like this...

FTP folder funcards to my webhost

(inside this folder is)

Folder images
Folder admin
Folder css
Folder myphpadmin (i installed myphpadmin in this folder - database ecards was created in this folder with myphpadmin)

( no fields or tables yet - setup.php is suppose to create them )

So my dilemma is I'm not sure how to link/code ecards database in $dbdatabase.

I did noticed when I installed myphpadmin it stated location was- - root>ecards. Not sure if this means anything but added it just in case.

To give an idea of what setup.php does when I run it, I get this:

Could not connect to the selected database: ecards. Check the config.php file to be sure you set the correct database server, database name, username, and password. Contact your system administrator if you do not know these values.

Just in case...I did contact server host for the information on mysql.
my website is with yahoo
my host is suppose to be 'mysql'

Any guidance or solution would greatly be appreciated!

If you need additional info feel free to ask here.

xxxx

Valeen
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: PLS HELP! Having trouble with config.php

Post by JakeJ »

Please post your exact connection string, for example:

Code: Select all

mysql_connect("localhost", "root", "root") or die(mysql_error());
@ mysql_select_db("database") or die(mysql_error());
 
User avatar
valeen10
Forum Newbie
Posts: 6
Joined: Fri Jan 22, 2010 8:16 pm

Re: PLS HELP! Having trouble with config.php

Post by valeen10 »

UPDATE:
This config.php file is from a free third party ecard script (complete). It has a config.php and once configured it goes to a setup.php to set up tables. The entire folder has been FTP on my webhost.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: PLS HELP! Having trouble with config.php

Post by AbraCadaver »

Just a guess but I would try:

Code: Select all

$dbhost = 'localhost'; // database host
$dbuser = 'whisper'; // database user name
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
valeen10
Forum Newbie
Posts: 6
Joined: Fri Jan 22, 2010 8:16 pm

Re: PLS HELP! Having trouble with config.php

Post by valeen10 »

Thanks for responding to my post. I've tried your suggestion but no luck, still get setup.php error. Not sure why I can't access my database. Yahoo is who I use for my website hosting, so wondering if they have selective privilege set or put restrictions on our file manager...hmmmm...something to look into.

Anyway thanks for your help abracadaver!

xxxx

Valeen
User avatar
SimpleManWeb
Forum Commoner
Posts: 57
Joined: Wed Dec 30, 2009 4:15 pm
Location: New Hampshire, USA

Re: PLS HELP! Having trouble with config.php

Post by SimpleManWeb »

Well, I agree with AbraCadaver that your dbhost is at least part of the issue. 99% of the time, that should be set to 'localhost'

Try something like this:

Code: Select all

 
     $dbhost = 'localhost'; // database host
     $dbuser = 'whisper'; // database user name
     $dbpass = 'yourpassword'; // I'm assuming you just put * there for security. This should be plain text in your file
     $dbdatabase = 'ecards'; // database with Cards tables
 
     mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
     mysql_select_db($dbdatabase) or die(mysql_error());
 
At very least, this should throw an error that may help.

Lastly, if you have the username and password to get into your yahoo account, you could always just go in there and change your mySQL username and password to whatever you want.
User avatar
valeen10
Forum Newbie
Posts: 6
Joined: Fri Jan 22, 2010 8:16 pm

Re: [RESOLVED] PLS HELP! Having trouble with config.php

Post by valeen10 »

Want to thank everyone who took time out of their day to help me with this dilemma.

Everyone was right about how the set up was but Yahoo likes to make life difficult to their clients who host with them.

For those who use Yahoo as their webhost, please be advised you're limited to privileges to your database (MYSQL//PHPmyAdmin). You can try to contact Yahoo to help but there is no guarantees they'll will.

For those using Yahoo PHPmyAdmin/MYSQL if you're a newbie to MYSQL and using your Cpanel BE CAREFUL if you're unsure of what to do you can accidentally deny yourself access in the privilege area. (saw this on another forum and wanted to share this with others here)

Yahoo Business MYsql info.
http://help.yahoo.com/l/us/yahoo/smallb ... ql-06.html

For those curious or didn't know that Yahoo is different from other host the code is as followed:

# $dbhost = 'mysql'; // database host (not localhost)
# $dbuser = 'whisper'; // database user name(your phpmyadmin username)
# $dbpass = 'yourpassword'; // I'm assuming you just put * there for security. This should be plain text in your file (your phpmyadmin password)
# $dbdatabase = 'ecards'; // database with Cards tables ( the database you created for the card tables...can be done in your Cpanel)
#


Once I did the above and did a test on my database, it worked the only problem I had is I don't have full privilege in my phpmyadmin thru my whisper@localhost because my privilege in Yahoo Mysql is listed as a 'wildcard/%' with 'USAGE' only. Once I can get full privilege like the 'yroot' then I can get this program to work! Once I do get it to work I'll post how I did it with a link here (to my blog) for those like me who are new wanting to get their database working too.

It may take me a while but I'll be back.

Hugs to everyone

Valeen

PS*** the 'yroot' is very important...Click link to find out why.
http://help.yahoo.com/l/us/yahoo/smallb ... ql-09.html
Post Reply