Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #8999

Re: Connecting to MySQL server....

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: Connecting to MySQL server....
Date 2013-04-07 14:17 -0400
Organization A noiseless patient Spider
Message-ID <kjsd2p$g29$1@dont-email.me> (permalink)
References <ddfedcf5-8332-4072-9f6d-43ac47a5a187@googlegroups.com> <ascq0fF180nU1@mid.uni-berlin.de> <kjror9$npa$1@dont-email.me> <asd9fnF4lg7U1@mid.uni-berlin.de>

Show all headers | View raw


On 4/7/2013 9:09 AM, M. Strobel wrote:
> Am 07.04.2013 14:32, schrieb Jerry Stuckle:
>> On 4/7/2013 4:45 AM, M. Strobel wrote:
>>> 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.
>>>
>>
>> "localhost" DOES use a socket (Linux) or named pipe (Windows).
>
> I am talking about the difference between AF_UNIX and AF_INET, on Linux - is this new
> that "localhost" does not start an IP connection? Can't check now, don't have a test DB.
>
> /Str.
>

No, localhost has NEVER started an IP connection in MySQL.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Connecting to MySQL server.... nag <visitnag@gmail.com> - 2013-04-06 20:23 -0700
  Re: Connecting to MySQL server.... "J.O. Aho" <user@example.net> - 2013-04-07 09:06 +0200
  Re: Connecting to MySQL server.... The Natural Philosopher <tnp@invalid.invalid> - 2013-04-07 09:07 +0100
  Re: Connecting to MySQL server.... "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-04-07 10:45 +0200
    Re: Connecting to MySQL server.... Jerry Stuckle <jstucklex@attglobal.net> - 2013-04-07 08:32 -0400
      Re: Connecting to MySQL server.... "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-04-07 15:09 +0200
        Re: Connecting to MySQL server.... The Natural Philosopher <tnp@invalid.invalid> - 2013-04-07 16:04 +0100
          Re: Connecting to MySQL server.... Jerry Stuckle <jstucklex@attglobal.net> - 2013-04-07 22:14 -0400
        Re: Connecting to MySQL server.... Jerry Stuckle <jstucklex@attglobal.net> - 2013-04-07 14:17 -0400
          Re: Connecting to MySQL server.... "Peter H. Coffin" <hellsop@ninehells.com> - 2013-04-07 20:08 -0500
            Re: Connecting to MySQL server.... Jerry Stuckle <jstucklex@attglobal.net> - 2013-04-07 22:13 -0400

csiph-web