p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   MySQL (http://p2p.wrox.com/forumdisplay.php?f=99)
-   -   Need Help for mysql connection (http://p2p.wrox.com/showthread.php?t=73493)

PHP65 March 22nd, 2009 08:38 PM

Need Help for mysql connection
 
Code:

$conn = mysql_connect(SQL_HOST,SQL_USER,SQL_PASS)
or die('Could not connect to the database; ' . mysql_error());
mysql_select_db('posts', $conn)
  or die('Could not select the database; ' . mysql_error());

when I run this code I get:

Code:

Could not select the database; Access denied for user ''@'localhost' to database 'posts'
No matter what the constants' values are.
[:confused:]

anees_muhd March 22nd, 2009 11:57 PM

Can you echo it out and see what is the values coming for
SQL_HOST,
SQL_USER,
SQL_PASS

So that we can ensure the values are not null

If it comes correctly please check the permission for SQL_USER to access the 'posts' Database

Regards
Anees

PHP65 April 3rd, 2009 07:59 PM

I get all non-null text from the constants
and now get in using mysqli_*() commands

the privileges were not a problem since i can do lots of stuff with a phpmyadmin that uses mysql_*() commands

PHP65 April 3rd, 2009 08:03 PM

anyway, it shouldn't accept any values for the password and then stop when it goes to select the database.
[:(!][:(!][:confused:]

sabra May 4th, 2009 02:48 AM

Hi PHP65
You go on: Beginning-PHP-6-Apache-MYSQL-6-DevelopmentCd-0470391146 and get code from this book.
Great luck


All times are GMT -4. The time now is 12:18 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.