Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'database connect'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. I am wondering if someone can help me with an intermittent database connection problem that I have started to experience. My environment is: . Windows 7 Home Premium 64 bit . Internet Explorer 10 . Firefox 22.0 . Dreamweaver MX2004 as the text editor . Xampplite 1.7.3 which comprises: .. Apache 2.2.14 .. PHP 5.3.1 .. MySQL 5.1.41 The problem occurs intermittently in both IE10 and Firefox, so appears not to be related to the browser. The message that I get is (and I stress that I don't always get it): Warning - mysql_connect() [function MySQL-connect]: Unknown MySQL server host 'localhost' (11001) with a reference to the PHP line of code. This is immediately followed by Fatal error Unknown MySQL server host 'localhost' (11001) with a reference to the same PHP line of code. My connection code is: $dbc = mysql_connect($local_hostname_xx, $local_username_xx, $local_password_xx) or trigger_error(mysql_error(),E_USER_ERROR); I am using the PHP mysql functionality as the production system does not support the mysqli functionality. If I have a look at the database with HeidiSQL (which provides MySQL admin-like functionality) the database and its data are all there. Can you also provide some specific guidance re the following: 1) I have a lot of PHP scripts that enable an administrator to update many aspects of the database tables. Most use Larry's PHP redux technique. In each script I require_once the php connection code followed immediately by the mysql_select_db statement. Should I be using 'require' rather than 'require_once'? 2) The database connection code does not use a persistent mysql_connect - should I be using a persistent connection i.e., mysql_pconnect function instead? 3) I do not close the database connection in the PHP scripts - should I? I have been using similar code for years without a problem. The problem seems to have started when I was experimenting with 'require' and 'require_once' to include the database connection code. I was also experimenting with mysql_connect versus mysql_pconnect in the connection code itself. Any advice will be most appreciated and thank you in anticipation. Best regards, Necuima.
×
×
  • Create New...