Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #8975
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!storethat.news.telefonica.de!telefonica.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | "M. Strobel" <sorry_no_mail_here@nowhere.dee> |
| Newsgroups | comp.lang.php |
| Subject | Re: Connecting to MySQL server.... |
| Date | Sun, 07 Apr 2013 10:45:03 +0200 |
| Lines | 31 |
| Message-ID | <ascq0fF180nU1@mid.uni-berlin.de> (permalink) |
| References | <ddfedcf5-8332-4072-9f6d-43ac47a5a187@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de 7Zj39gmMRMJEY/2GYniqoAFtAt0tvDdDYrqi0jfF2KnHxW6uA= |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 |
| In-Reply-To | <ddfedcf5-8332-4072-9f6d-43ac47a5a187@googlegroups.com> |
| Xref | csiph.com comp.lang.php:8975 |
Show key headers only | View raw
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.
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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