MySQL Forums
Forum List  »  PHP

Query/connect works in versions <4.1, not in 4.1
Posted by: William Heffner
Date: January 12, 2006 04:44PM

The following is the database connection in a separate php file:
$Host = "localhost"; // server name
$User = "user"; // database param
$Password = "pass"; // database param
$dbName = "name"; // database name
$Link = mysql_pconnect($Host, $User, $Password);
mysql_select_db($dbName, $Link); // link to the main database by default

Here is the problematic code:
include "db_connect.php";
$Query = "SELECT * FROM eh_event WHERE Date='2006-01-06'";
$Result = mysql_query($Query, $Link);
while ($Row = mysql_fetch_array($Result))
{ // etc

$Link is reported as an invalid resource-link, and $Result and $Row as invalid.

However, elsewhere on the same server the inclusion of db_connect.php results in a good connection with the database and the query and output is just fine.

Server params:
- PHP 4.3.11 (register_globals = ON / CGI)
- Perl 5.8.3 (/usr/bin/perl)
- Fedora Core 2 - Linux (custom kernel)
- Apache 2 (custom build)
- Sendmail 8 (/usr/sbin/sendmail)
- Bind 9
- MySQL 4.1 (localhost only)

Options: ReplyQuote


Subject
Written By
Posted
Query/connect works in versions <4.1, not in 4.1
January 12, 2006 04:44PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.