There was a problem loading the comments.

SQL errors

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

This is not an error you see in cPanel. This is the code you use to connect a php file to the database. (Be sure to replace the red parts with your actual information.)

Connection Strings
Perl $dbh = DBI->connect("DBI:mysql:cpuser_db:localhost","cpuser_dbuser","password");
PHP $dbh=mysql_connect ("localhost", "cpuser_dbuser", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("cpuser_db");

Some real errors are as follows:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'someone'@'localhost' (using password: YES) in /home/cpusername/public_html/config.php on line 3
Couldn't connect to server.

This error tells you the exact situation. "Access denied" is your big clue! This means that the database user or password is incorrect in your php file. The database name must always be cpanelusername_databaseusername. You can check the correct spelling in cPanel, under MySQL Databases.


Parse error: syntax error, unexpected T_STRING in /home/cpusername/public_html/index.php on line 31

This error means you have made a mistake in your coding. Usually it is a missing punctuation, as PHP code is very sensitive. I apologize, but we cannot offer support for PHP coding mistakes.


Share via
Did you find this article useful?  

Related Articles


Comments

Add Comment

Replying to  

CAPTCHA
© Osirion System Technologies