Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-24-2012, 08:28 PM   PM User | #1
Mike1963
New Coder

 
Join Date: May 2011
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
Mike1963 is an unknown quantity at this point
double data insertion

Hi guys (and gals),

i am having a very strange problem with an insertion query in wordpress, i am trying to track how many times members click on links from a certain page but every time a link is clicked it inserts 2 links at the same time, 1 that you actually clicked on and another that is totally different! even some of the links that is being entered are on a totally different page. I have been fussing with this problem for the past few days now and can not figure it out, hopefully someone out there can help as this project is already a couple weeks behind schedule. Heres my query:

PHP Code:

if($_SESSION['member_id']){
    
$logged=mysql_query("select * from members where member_id = '".$_SESSION['member_id']."'");

$row=mysql_fetch_array($logged);

$member_id $row['member_id'];
$company_id $row['company_id'];

$check=mysql_query("SELECT * from analytics where member_id = '$member_id' AND company_id = '$company_id' AND temp_id = 'vid' AND page_url='http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']."'")or die(mysql_error());

$row=mysql_fetch_array($check);

$member_id $row['member_id'];
$company_id $row['company_id'];
$num_hits $row['num_hits'];
$page_url $row['page_url'];
$temp_id $row['temp_id'];

if(
$member_id == '' && $company_id == '' && $temp_id == '' && $page_url == ''){
    
mysql_query("INSERT INTO analytics (member_id,company_id,num_hits,temp_id,page_url)VALUES('".$_SESSION['member_id']."','".$company_id."','1','vid','http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']."')") or die (mysql_error()."in <br>$query" );
//$result = mysql_query($query) or die (mysql_error()."in <br>$query" );

}


Mike1963 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:02 PM.


Advertisement
Log in to turn off these ads.