note 46791 added to function.mysql-connect

From: Date: Sat, 23 Oct 2004 11:07:43 +0000
Subject: note 46791 added to function.mysql-connect
Groups: php.notes 
Request: Send a blank email to php-notes+get-78992@lists.php.net to get a copy of this message
Hi there, I am trying to use an adapted version of the code posted by caleg. I am using the code in a simple forum which runs perfectly on a windows machine under apache 2 and php 4. However, this code does not run under mac os x with the default apache build from apple and apache 5. Whenever I try to access a database I always get the error : no database selected. Is this because I run PHP 5 on my mac? Here is the first part of my code.... <? class BlogUser { function BlogUser() { $this->host = "localhost"; $this->db = "blog"; $this->user = ""; $this->pass = ""; $this->link = mysql_connect($this->host, $this->user, $this->pass)or die("Database Connection Error: ".mysql_error()); mysql_select_db($this->db, $this->link); register_shutdown_function(array(&$this, 'close')); } ---- Manual Page -- http://www.php.net/manual/en/function.mysql-connect.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46791 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46791&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46791&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46791&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46791&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46791&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46791&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+46791&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#78992) next »