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


Groups > comp.lang.php > #8169

Re: about php connection string

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From "Peter H. Coffin" <hellsop@ninehells.com>
Newsgroups comp.lang.php
Subject Re: about php connection string
Date Fri, 1 Feb 2013 08:55:46 -0600
Organization A noiseless patient Spider
Lines 42
Message-ID <slrnkgnlri.m9f.hellsop@nibelheim.ninehells.com> (permalink)
References <839bd343-9011-4c1d-952f-760377d5a2dd@googlegroups.com> <op.wrtqrxz1ptrp3x@neonk2.intrahouse.local> <keg8uq$ohd$1@news.albasani.net>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Injection-Info mx05.eternal-september.org; posting-host="4163d0103afdb3d32fe6c98974b1e330"; logging-data="24068"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TudEx5U/43/jdOctBVxH5"
User-Agent slrn/0.9.9p1 (OpenBSD)
Cancel-Lock sha1:0NTghib3ppioPYprsPQ+0s6b8cU=
Xref csiph.com comp.lang.php:8169

Show key headers only | View raw


On Fri, 01 Feb 2013 11:29:30 +0000, The Natural Philosopher wrote:
> On 01/02/13 11:12, Kim Andr?? Aker?? wrote:
>> P?? Fri, 01 Feb 2013 08:47:36 +0100, skrev <amitjaluf@gmail.com>:
>>
>>> Hello All
>>> i am writing a connection string to connect database to the web page
>>> but when i run this with Firefox it shows Nothing. I am using
>>> Linux(Debian) on machine.
>>>
>>> here is the code can anyone help me where i am wrong.
>>>
>>> <?php
>>>      $db=mysql_connect("localhost","xyz","");
>>>      mysql_select_db("mysql",$db);
>>>      $rs=mysql_query("select * from emp",$db);
>>>      printf("User: %s\n",mysql_result($rs,0,"Ename"));
>>> ?>
>>
>> First, what do you see if you view the page source in Firefox? Do you
>> see your original PHP code, or is it just blank? If you see PHP code, it
>> would mean that your server (Apache, nginx, etc) is not configured to
>> process PHP code.
>>
>> Second, does the database user you use to connect with actually have
>> access to the database you're selecting?
>>
>> If you don't see PHP code in your page source, you might have errors in
>> your query or database connection. To see the errors, I suggest you
>> temporarily enable error reporting to see any hidden error messages. You
>> can do this in runtime by putting these two lines at the top of your
>> first <?php code block:
>
> I found that later versions of mysql tend to default to NOT allowing 
> 'localhost' but will accept '127.0.0.1'

#1 newbie trap. "localhost" is NOT A NETWORK CONNECTION to mysql.
"localhost" is a OS socket or named pipe connection, depending on OS.

-- 
Cunningham's First Law:
Any sufficiently complex deterministic system will exhibit
non-deterministic behaviour.

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


Thread

about php connection string amitjaluf@gmail.com - 2013-01-31 23:47 -0800
  Re: about php connection string Kim André Akerø <kimandre@nospambetadome.com> - 2013-02-01 12:12 +0100
    Re: about php connection string The Natural Philosopher <tnp@invalid.invalid> - 2013-02-01 11:29 +0000
      Re: about php connection string Jerry Stuckle <jstucklex@attglobal.net> - 2013-02-01 08:46 -0500
      Re: about php connection string "Peter H. Coffin" <hellsop@ninehells.com> - 2013-02-01 08:55 -0600
    Re: about php connection string amitjaluf@gmail.com - 2013-02-03 19:41 -0800

csiph-web