logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: Mysql connect issue from one script but not others..
Author
Jfisher



Joined: 21 Oct 2006
Posts: 3
Location: Orlando FL.

PostPosted: Sat 17 Feb '07 1:17    Post subject: Mysql connect issue from one script but not others.. Reply with quote

Just throwing this out to see if anyone might have an answer.
I have a simple include file for the standard Mysql connection.

I can access the database / tables with all other scripts fine with the exception of one, and I get this error when checking a query from an insert.

Can't connect to MySQL server on 'localhost' (10061)

I have looked up the error but have found nothing that seems to be the problem. I have phpmyadmin working fine aswell as a few phpbb forums.

Also a few of my own wip web apps are working also using this same included connect below, edited of course with the right info.

I'm open for any ideas.

My connect script looks like:

$some_guest = @mysql_pconnect('.', 'some_guest', 'some_guest');
if (!$some_guest){
exit ('User guest is unable to log in.');
}

mysql_select_db("this_general_db") or
die ("ERROR: unable to connect to database");
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Mon 19 Feb '07 10:30    Post subject: Reply with quote

Sure that the script is executed? Maybe some issue with short php tags.
Run your include file alone, remove the @ so that you can see if there is an error. You also could add error_reporting(E_ALL); in the first line to see more debugging information.

Improve your errorhandling

Code:

if (!mysql_select_db("nonexistentdb", $link)) {
   echo mysql_errno($link) . ": " . mysql_error($link). "\n";
}


see the docs your more details

http://de2.php.net/mysql_errno
Back to top


Reply to topic   Topic: Mysql connect issue from one script but not others.. View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner