Jump to content

My scripts won't connect to the server database....?


gizmorattler

Recommended Posts

I have a quick connection test script, a connect_to_mysql .php script, and a create_Table.php script. Nothing connects to my server for some reason. When I try running the mysql_quicktest.php file in my browser I think it runs from (and on) the testing server version and returns an error of:

 

Warning: require(...\...\scripts\connect_to_mysql.php) [function.require]: failed to open stream: Invalid argument in C:\xampp\htdocs\KNIRV\scripts\PHP\mysql_quicktest.php on line 3

 

Fatal error: require() [function.require]: Failed opening required '...\...\scripts\connect_to_mysql.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\KNIRV\scripts\PHP\mysql_quicktest.php on line 3

 

BUT THE FILE connect_to_msql.php IS RIGHT THERE ON THE SERVER! Why isn't it working? So I ran the connect_to_msql.php script alone and it returned an error of:

 

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'perry100_gizmo'@'localhost' (using password: YES) in C:\xampp\htdocs\KNIRV\scripts\PHP\connect_to_mysql.php on line 13

could not connect to mysql

 

Please help. I know it will be something small that I missed. I've included the scripts, I'll change the passwords later. I just know I've looked over everything. Maybe I could use a more expert perspective!?

 

 

 

 

 

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

A) You have two many dots ... in your file path in the require() statement. It's two dots to go one folder closer to the disk root.

 

B) You have not setup your database username and password to have access to any database.

 

C) You are trying to mix mysql_ and mysqli_ functions. You must pick one type and use it for any particular connection.

Link to comment
Share on other sites

Thank you for the edification. It is much appreciated. Though, the problem still doesn't reveal itself to me at this time...

 

When I run the connect_to_mysql.php script alone it gives me this:

 

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'perry100_gizmo'@'c-174-61-74-192.hsd1.fl.comcast.net' (using password: YES) in C:\xampp\htdocs\KNIRV\scripts\PHP\connect_to_mysql.php on line 13

could not connect to mysql

[

Even without the my_quicktest.php script, there is an error. What am I missing here?

 

This is what the connect_to_mysql.php script looks like now (figured I'd save you the download time):

 

<?php 

// Place db host name. Sometimes "localhost" but 

// sometimes looks like this: >>      ???mysql??.someserver.net

$db_host = "174.120.170.60";

// Place the username for the MySQL database here

$db_username = "perry100_gizmo"; 

// Place the password for the MySQL database here

$db_password = "raiders"; 

// Place the name for the MySQL database here

$db_name = "perry100_MarketUpdates";

 

// Run the connection here 

$myConnection = mysql_connect("$db_host","$db_username","$db_password", "$db_name") or die ("could not connect to mysql"); 

// Now you can use the variable $myConnection to connect in your queries     

?>

 

I know that database exists with that user and that password... you could probably try it yourself before I change it.... Please help!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.