Jump to content


Photo

connecting php and mysql


  • Please log in to reply
6 replies to this topic

#1 jivemebaby

jivemebaby
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 11 December 2005 - 01:13 PM

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

#2 Gaia

Gaia
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts
  • LocationCanada

Posted 11 December 2005 - 02:34 PM

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

#3 jivemebaby

jivemebaby
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 11 December 2005 - 03:23 PM

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



#4 Gaia

Gaia
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts
  • LocationCanada

Posted 11 December 2005 - 05:49 PM

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.

#5 jivemebaby

jivemebaby
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 11 December 2005 - 07:42 PM

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

#6 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 24 December 2005 - 02:42 AM

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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#7 Captain_Pugwash

Captain_Pugwash
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 24 December 2005 - 09:13 AM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users