SEO TIPS

2013 SEO Tips

BLOGGER TIPS

Best Blogger Tips

INCREASE TRAFFIC

Expert Tips To increase traffic

ONLINE TOOLS

100 Online Tools

INCREASE INDEX RATE

Increase your google index rate

IMPROVE ALEXA RANK

Improve alexa rank

SEO TOOLS

51 SEO Tools

PHP SCRIPT

Essential PHP Scripts

Php my sql server error Fix

Fix and Solution for all php and mysql server error messages, including “could not connect to databse”, sql server error 6,53,17,233,1000,18452,10061 and 18456.

Php my sql server error Fix
Php my sql server error Fix


“Could not connect to database”

mysqli_connect( localhost, 'mor' , 'fromork' ) or die ( 'could not connect' )
When this command fails, the words "could not connect" are displayed on the webpage. it tells us that something went wrong. but it does not give us information beyond that.

Fortunately PHP offers a function, mysql_error(), but that will give us clue as to exactly what went wrong. Consider this code where we are trying to connect to a MySQL server that does not exist.
<?php
   mysqli_connect('badhostname', 'mork', 'fromork' ) or die (mysqli_error());
?>

Here is the error message you will get.

Unknown MySQL server host 'badhostname' (1)


this will return clear information as to what actually went wrong when the mysqli_connect() function fails. You can also use mysqli_error () with other mqsqli functions.

<?php
       $dbc = musqli_connect('localhost' ,  'mork'  , 'fromork');
      mysqli_select_db ($dbc, 'alien_database');
      echo mysqli_error($dbc) . '<br />';
      mysqli_select_db($dbc, 'alien_database');
      mysqli_query($dbc, 'alien_database');
      mysqli_query($dbc, "SELECT * FROM alien_info");
     echo mysqli_error($dbc);
?>

In the above code:



we try to connect to a database that does not exist.

we try to SELECT from a table that dows not exist.

Here is the output



unknown database 'alien_database'
table'alien_info' doesn't exist


Here are some other error message you might see:



Table 'test.no_such_table' doesn't exist
Can't create table
Can't create database 'yourdatabase'; database exists
Can't drop database 'yourdatabase(; database doesn't exist


There are dozens more , and it would be a waste of page to list them here .Browse on over to this site to get more information

http://dev.mysql.com/doc/refman/5.0/en/error-messages-server.html If you are retrofitting your mysql functions as mentioned above, you can use mysql_error() instead of mysqli_error().

Incoming search terms



couldn t connect to database
mysql connect to database
sql server error 18456
php connect to database
sqlserver error
sql server error 53
sql server error 17
error sql server 2000
sql server error 6
unable to connect to database server
sql server error 233
sql server error 18452
sql server error 10061



2 comments :

  1. TCloud Technologies provides training programs with an outlook towards future. Our vision is to conduct forward-thinking telecom research and provide education and telecom training opportunity for industry professionals around the world.We are a team of few aspiring minds who had worked extensively in telecom domain for the past 7-10 years". No one can match us in our material, faculty and service.

    ReplyDelete