mdmartiny Posted October 1, 2011 Share Posted October 1, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/248221-value-depreciation-in-pear/ Share on other sites More sharing options...
trq Posted October 1, 2011 Share Posted October 1, 2011 What is in config.php ? The errors you see are in PEAR itself which you don't appear to even be using. Quote Link to comment https://forums.phpfreaks.com/topic/248221-value-depreciation-in-pear/#findComment-1274623 Share on other sites More sharing options...
mdmartiny Posted October 1, 2011 Author Share Posted October 1, 2011 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'"); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/248221-value-depreciation-in-pear/#findComment-1274625 Share on other sites More sharing options...
trq Posted October 1, 2011 Share Posted October 1, 2011 I don't see how any of that code could produce the errors you are describing. Is your auto_prepend_file directive set to anything within your php.ini? Quote Link to comment https://forums.phpfreaks.com/topic/248221-value-depreciation-in-pear/#findComment-1274630 Share on other sites More sharing options...
mdmartiny Posted October 1, 2011 Author Share Posted October 1, 2011 I do not know I will open it up and look to see Quote Link to comment https://forums.phpfreaks.com/topic/248221-value-depreciation-in-pear/#findComment-1274631 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.