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

Home » Imported messages » comp.lang.php » about php connection string
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: about php connection string [message #180235 is a reply to message #180231] Fri, 01 February 2013 14:55 Go to previous messageGo to previous message
Peter H. Coffin is currently offline  Peter H. Coffin
Messages: 245
Registered: September 2010
Karma:
Senior Member
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(at)gmail(dot)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.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to get data for website pages..
Next Topic: Hot list for BA/QA, BA – Insurance, Embedded Engineer & Technical BM
Goto Forum:
  

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

Current Time: Thu Sep 19 02:10:00 GMT 2024

Total time taken to generate the page: 0.04631 seconds