Jump to content

Archived

This topic is now archived and is closed to further replies.

jivemebaby

connecting php and mysql

Recommended Posts

hi,

 

im having terrible trouble connecting php and mysql. i cant seem to get them to work together. i keep getting error messages such as:

 

Warning: Access denied for user 'ODBC'@'localhost' (using password: NO) in c:\phpdev\private\signupck.php on line 26

 

Warning: MySQL Connection Failed: Access denied for user 'ODBC'@'localhost' (using password: NO) in c:\phpdev\private\signupck.php on line 26

Could not connect to MySQL

 

am i suppose to put all the files in the same location? i really dont know what im doing wrong, new to php :)

 

any asisstance would be much appreciated.

 

Thanks,

 

SH

Share this post


Link to post
Share on other sites

If you could, post the code you are using to connect.

Share this post


Link to post
Share on other sites

hi,

 

i downloaded this tutorial:

 

[a href=\"http://www.plus2net.com/php_tutorial/php_signup.php\" target=\"_blank\"]PHP member signup script using mysql[/a]

 

it contains all the files. but when i tried to run it on my localhost, and typed in info into the signup page, i was given the following error:

 

Warning: Access denied for user 'ODBC'@'localhost' (using password: NO) in c:\phpdev\www\public\signupck.php on line 26

 

Warning: MySQL Connection Failed: Access denied for user 'ODBC'@'localhost' (using password: NO) in c:\phpdev\www\public\signupck.php on line 26

Could not connect to MySQL

 

im not sure what i did wrong. any suggestions as to how im suppose to connect the database? if you can help that would be great!

 

THanks,

 

SH

 

 

Share this post


Link to post
Share on other sites

This isn't really the place for third party scripts.

 

But, open up all the files that you download and at the top you should see something like tihs:

 

$dbservertype='mysql';
$servername='localhost';
// username and password to log onto db server
$dbusername='';
$dbpassword='';
// name of database
$dbname='sql_tutorial';

 

You need to fill those variables in with your information.

Share this post


Link to post
Share on other sites

hi,

 

thanks for the info. di have to create a database called sql_tutorial myself? will it matter where i store the database? thanks

 

sh

Share this post


Link to post
Share on other sites

Yes, you have to run a CREATE DATABASE statement, or do it via PHPMyAdmin; and I don't know what you mean by "where" you store the DB.

Share this post


Link to post
Share on other sites

Firts off do actually have MySQL installd & then have you created your database. I do this sounds like a stupid question, but i've seen it happen.

 

If you have the standard

$db = mysql_connect(host, username,passowrd ) should get you a connection to mysql. You then have to connect to the actual database using

mysql_select_db(DbName,$db)

 

and then you're off. if you don't have mysql or you are having trouble creating a databse come back to us

Share this post


Link to post
Share on other sites

×

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.