Jump to content

data not being passed into db


loganbest

Recommended Posts

I have this code to enter stuff into my db, When someone views a profile it's supposed to add 1 to the views column but it doesn't.

This is the latter of the code that matters.

 

 
  $who = intval($who);
  $shared = mysql_query("select * from userdb where id=" . $who . "");
  $sharedinfo = mysql_fetch_array($shared);

/* Add hit */
  if($sharedinfo[id] != $playerinfo[id]) {
    if($playerinfo[name] != "") {
      $t1mnow = time();
      $startletter = $playerinfo[id]{0};
    $whoviewed = defaultpic($playerinfo[id],"viewedlink");

      if($who != 5) {
        $r = mysql_fetch_array(mysql_query("SELECT ghost FROM userdb WHERE id='$playerinfo[id]' LIMIT 1"));
        if($r[ghost] == 0) {
          mysql_query("insert into profileviews set whoviewed='" . $whoviewed . "', whoseprofile=$sharedinfo[id], lastin=" . $t1mnow . "") or die();
        }
      }
    }
  }
  
  /* Add hit part 2 */
  if($who != 5) {
   if($c_email != "") {
      if($playerinfo[id] != "$sharedinfo[id]") {
        if($playerinfo[lastviewed] != "$sharedinfo[id]") {
          if($sharedinfo[views] >= "1") {
            mysql_unbuffered_query("update userdb set views=1, newviews=1 where id=" . $sharedinfo[id] . "");
          }else{
            $ghost = mysql_query("SELECT ghost FROM userdb WHERE id=". $playerinfo[id]. " LIMIT 1");
            $r = @mysql_fetch_array($ghost);
            if($r[ghost] == 0) {
              mysql_unbuffered_query("update userdb set views='views+1', listviews='listviews+1', newviews=1, friends=" . $net . " where id=" . $sharedinfo[id] . "");
            }else{
              mysql_unbuffered_query("update userdb set views='views+1', listviews='listviews+1', friends=" . $net . " where id=" . $sharedinfo[id] . "");
            }
          }
       }
      }
    }else{
      mysql_unbuffered_query("update userdb set views='views+1', friends=" . $net . " where id=" . $sharedinfo[id] . "");
    }
  }

Link to comment
Share on other sites

if nothing else, you probably need to wrap some of your arrays, for instance:

 

{$sharedinfo[id]}

 

I always try to consistently single-quote every field. Sometimes you do, sometimes you don't. If you made it consistent, that might help you fix the problem.

 

I don't quite get where you want me to wrap my array.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.