FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Connecting to MySQL server....
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Connecting to MySQL server.... [message #181034 is a reply to message #181031] Sun, 07 April 2013 08:45 Go to previous messageGo to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
Am 07.04.2013 05:23, schrieb nag:
> Hi,
>
> I have debconnect.php like the following...
>
>
> <?php
>
> $con=mysql_connect("localhost","root","") ;
>
> if(!$con){
> die('Error in Connection: '. mysql_error());
> }
> mysql_select_db('newdb',$con);
>
> ?>
>
> If I give the password or user name wrong it is flashing the error, but if the database name wrong it is simply displaying a blank php file. How can I change the above to show the error even if the wrong database name is given.
>
> Thank you.
>
>
>
>
Two more observations:

- you are using the deprecated mysql API, use mysqli or PDO instead.
- if the db server is local, it is a lot faster to connect to a path pointing to a
local socket

/Str.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: comparing arrays
Next Topic: PHP with MS SQL SERVER: is it suitable?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Dec 01 00:01:57 GMT 2024

Total time taken to generate the page: 0.04048 seconds