[PLUG] Another PHP & MySQL problem
Richard Steffens
rsteff at attbi.com
Sat Mar 23 17:38:54 UTC 2002
Brent Washburne wrote:
> If db_fns.php is included twice, then db_connect will be declared
> twice. Check to see if book_sc_fns.php or db_fns.php is included more than
> once.
index.php has these lines:
<?
include ('book_sc_fns.php');
// The shopping cart needs sessions, so start one
session_start();
do_html_header("Welcome to Book-O-Rama");
echo "<p>Please choose a category:</p>";
// get categories out of database
$cat_array = get_categories();
// display as links to cat pages
display_categories($cat_array);
// if logged in as admin, show add, delete, edit cat links
if(session_is_registered("admin_user"))
{
display_button("admin.php", "admin-menu", "Admin Menu");
}
do_html_footer();
?>
book_sc_fns.php has these lines:
<?
include_once("db_fns.php");
include_once("data_valid_fns.php");
include_once("output_fns.php");
include_once("book_fns.php");
include_once("user_auth_fns.php");
include_once("admin_fns.php");
include_once("order_fns.php");
?>
The file db_fns.php has these lines:
<?
function db_connect()
{
$result = @mysql_pconnect("localhost", "book_sc", "password");
if (!$result)
return false;
if (!@mysql_select_db("book_sc"))
return false;
return $result;
}
function db_result_to_array($result)
{
$res_array = array();
for ($count=0; $row = @mysql_fetch_array($result); $count++)
$res_array[$count] = $row;
return $res_array;
}
?>
No other file contains function db_connect().
--
Regards,
Dick Steffens
"Quando Omni Flunkus Moritati"
http://rsteff.home.attbi.com/
More information about the PLUG
mailing list