Halaman Utama > Knowledgebase > Databases > SQL errors


SQL errors




This is not an error you see in cPanel. This is the code you use to connect a php file to the database.

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.



Apakah Jawaban ini membantu?

Tambahkan ke Favorit Tambahkan ke Favorit    Cetak Artikel Ini Cetak Artikel Ini

Baca Juga
MySQL Collation (Dilihat: 352)
Lost database password (Dilihat: 280)

Powered by WHMCompleteSolution