php - Inserting multiple rows into database -


i have <?php include 'stats.php'; ?> on every page on site. in stats.php file there sql insert query inserts data table in database.

for reason when visiting 1 page inserts 4 rows database - there 1 sql command.

why doing this... below code on stats.php file

<?php    $activity_history_sql=       "insert user_activity_history (user_seq, user, timestamp, ip_address, user_request_uri,                user_script_filename, user_script_uri, user_script_url, user_script_name, user_php_self)         values ('".$_session["domain.co.uk"]["sequence"]."',               '".$_session["domain.co.uk"]["forename"].' '.$_session["domain.co.uk"]["surname"]."',               '".date("y-m-d h:i:s")."',               '".$_server["remote_addr"]."',               '".$_server["request_uri"]."',               '".$_server["script_filename"]."',               '".$_server["script_uri"]."',               '".$_server["script_url"]."',               '".$_server["script_name"]."',               '".$_server["php_self"]."') ";     $activity_history_rs=mysql_query($activity_history_sql,$conn) or die(mysql_error()); ?> 

please use require_once() when including stats.php.

the require_once statement identical require except php check if file has been included, , if so, not include (require) again.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

python 3.x - PyQt5 - Signal : pyqtSignal no method connect -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)