User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,552 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,472 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 3137 | Replies: 4
Reply
Join Date: Aug 2004
Posts: 14
Reputation: phpnovice is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
phpnovice phpnovice is offline Offline
Newbie Poster

help for connection to mysql

  #1  
Aug 14th, 2004
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2004
Posts: 177
Reputation: YoungCoder is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
YoungCoder's Avatar
YoungCoder YoungCoder is offline Offline
Junior Poster

Solution Re: help for connection to mysql

  #2  
Aug 14th, 2004
<?php
mysql_connect("localhost", "username", "password");
?>

Change to:

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

YoungCoder
Reply With Quote  
Join Date: Aug 2004
Posts: 14
Reputation: phpnovice is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
phpnovice phpnovice is offline Offline
Newbie Poster

Re: help for connection to mysql

  #3  
Aug 16th, 2004
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


Originally Posted by YoungCoder
<?php
mysql_connect("localhost", "username", "password");
?>

Change to:

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

YoungCoder
Reply With Quote  
Join Date: Aug 2004
Posts: 177
Reputation: YoungCoder is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
YoungCoder's Avatar
YoungCoder YoungCoder is offline Offline
Junior Poster

Solution Re: help for connection to mysql

  #4  
Aug 16th, 2004
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]
<?php
$conn = mysql_connect("localhost", "username", "password");
or die (mysql_error());
?>
[/php]

Hope this helps,

YoungCoder
Reply With Quote  
Join Date: Apr 2004
Location: Tracy
Posts: 744
Reputation: Killer_Typo will become famous soon enough Killer_Typo will become famous soon enough 
Rep Power: 7
Solved Threads: 32
Killer_Typo's Avatar
Killer_Typo Killer_Typo is offline Offline
Master Poster

Re: help for connection to mysql

  #5  
Aug 16th, 2004
http://www.daniweb.com/techtalkforums/thread6958.html

check out this snippit i wrote, hopefully it will help you some.
!!!!! WARNING YOUR COMPUTER MAY BE INFECTED WITH SPYWARE!!!! PAY AN OVER PRICED AMMOUNT TO HAVE SOMTHING FIXED WE PLACED THERE IN THE FIRST PLACE!!!!!!!!!

sound familiar, know how to block yourself and keep yourself clean.
_____________________
http://www.lavasoftusa.com/ -->adaware
http://www.safer-networking.org/en/index.html -->spybot S&D
http://www.javacoolsoftware.com/spywareblaster.html -->spywareblaster
http://www.javacoolsoftware.com/spywareguard.html -->spywareguard
_____________________
and dont forget to spread the reputation to those that deserve!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 5:18 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC