Jump to content

Value Depreciation in PEAR


mdmartiny

Recommended Posts

When I put all my code in one file, everything runs smooth, as soon as I try to put a chunk of code in a separte PHP file and use an include or require_once I get the error Assigning the return value of new by reference is deprecated in...PEAR\config.php yadda yadda

 

I've done some research and I understand that passing an object by reference (&obj) is no longer acceptable in PHP 5, that's fine, but no where in my code do I have an ampersand, and again, it all works fine if it's all in the same .php file. So i figure i might be doing something wrong with my includes or something.

 

The errors that I am getting are

 

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\PEAR\Config.php on line 80

 

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\PEAR\Config.php on line 166

 

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\PEAR\Config\Container.php on line 111

 

include('config.php');
connect();

while ($row = mysql_fetch_assoc($ran_result)) {
    $ran_image = $row['image'];
    $category = $row['category'];
    $last = $row['l_name'];
    $first = $row['f_name'];
    $return = $row['item_return'];
}

echo "<div id='random'>\n";
echo "<h1>Random Signatures</h1>\n";
echo "<img src='../auto_images/$ran_image' /><br />\n";
echo "<p><a href='../auto_pages/signatures.php?c=$category&l=$last&f=$first'>$first $last</a></p>\n";
echo "<p>$return</p>\n";
echo "<br>";
echo "</div>";
?>

 

Am I doing something wrong with the include?

Link to comment
https://forums.phpfreaks.com/topic/248221-value-depreciation-in-pear/
Share on other sites

This is my config file

 

<?php

function connect() {
    $host = 'localhost';
    $username = 'root';
    $dbname = 'michael48060';
    $dbpassword = '';

    $connection = mysql_connect($host, $username, $dbpassword);
    $db = mysql_select_db($dbname, $connection);

    if (!$connection) {
        die('Could not make a connection to MySql Database' . mysql_error());
    }

    if (!$db) {
        die('Could not connect to DB $dbname' . mysql_error());
    }
}

function counter () {
$pagename = $_SERVER["REQUEST_URI"];
$result = mysql_query("SELECT * FROM counter WHERE pagename ='$pagename' ");

if (mysql_num_rows($result)==0) {
	mysql_query("INSERT into counter(pagename,hits) VALUES ('$pagename', '1')");
} else {
	mysql_query("UPDATE counter SET `hits` = `hits` + 1 where pagename = '$pagename'");
}
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.