|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-02-23 23:39 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 19:00:01 2025 UTC |
Description: ------------ I have version 5.1.2. THIS MIGHT HAVE BEEN FIXED IN 5.2.1!!! First use mysql_connect() on an included file and return the resource identifier and store this in a variable. Then call session_start() Now you have lost your resource identifier! Calling session_start() first fixes the problem. Reproduce code: --------------- file1.php function connect_to_db() { $link = mysql_connect($host, $user, $pass) or die(err_msg); mysql_select_db($db) or die(err_msg); return $link; } file2.php include 'file1.php'; $link = connect_to_db(); echo $link; session_start(); echo $link; Expected result: ---------------- link resource id# ? link resource id# ? replace ? with a number Actual result: -------------- link resource id# ? 0