Hi,

I have apache, php, phpmyadmin, and mysql in my computer.

I could connect to mysql and manipulate database well before. But for an unknown reason, I can't do it now. Each time when I tried to do this, it gave an error message as "Can't create TCP/IP socket (10091)". My simplified php script is:

<?php
mysql_connect("localhost", "username", "password");
?>

I will really appreciate it if someone would help me.

Thanks a lot.

phpnovice :sad:

Recommended Answers

All 4 Replies

<?php
mysql_connect("localhost", "username", "password");
?>

Change to:

<?php
$conn = mysql_connect("localhost", "username", "password");
          or die ("Couldn't connect to server.");
?>

YoungCoder

Hi,

Thanks a lot for your reply. I will try your code sometime. But I guess the problem might come from Apache because it works fine now when I switched to Abyss.

It appears Apache has more protection than that Abyss does. So, I will switch back and test your code.

Do you have any thoughts on my reply? As my name, php novice, indicates, any reply will be helpful.

Thank you again.

phpnovice

<?php
mysql_connect("localhost", "username", "password");
?>

Change to:

<?php
$conn = mysql_connect("localhost", "username", "password");
          or die ("Couldn't connect to server.");
?>

YoungCoder

Well to tell the truth i think your previouscode should have worked, al i can really think of is that there may be a problem later on in the code, i have never acctually come accross that specific error myself...

You may be able to get more information on the problem by using mysql_error()

e.g:

<?php
$conn = mysql_connect("localhost", "username", "password");
          or die (mysql_error());
?>

Hope this helps,

YoungCoder

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.