By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,327 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

problem mysql_connect with php

P: 1
sir
i wrote the code to connect php with mysql
but it create error
CODE
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $con = @mysql_pconnection("localhost","utsavi",****);
  3. if ($con)
  4. echo("connect");
  5. }
  6. ?>
ERROR
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in E:\vnr\utsavi1\xampp\htdocs\cnc.php on line 6
Error connecting to mysql

PLEASE
send me right information & code
Mar 24 '10 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
mysql_pconnection() is no native PHP function (that would be mysql_pconnect()), however, you connect through mysql_connect(), reason for that: your function fails, but by calling mysql_select_db(), it tries to open a connection with mysql_connect() using the default values.

you manage to log in as "root", not as "utsavi". obviously the two passwords don’t match.

no neet to use @ to suppress errors (that usually backfires to you in some way)
Mar 24 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.