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
https://forums.phpfreaks.com/topic/65631-data-not-being-passed-into-db/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.