Jump to content

Recommended Posts

Ok I have this code that works great where it is now but when I try to add it to other pages it won't work. Here is the original code:

/* Update video data; views count */

if (!isset($_SESSION["video_view"]) or (isset($_SESSION["video_view"]) and $_SESSION["video_view"] != $row["id"])) {

myQ("UPDATE `[x]video` SET `views` = `views` + '1' WHERE `id`='{$row["id"]}'");

$_SESSION["video_view"] = $row["id"];

 

 

And here's my changed code:

/* Update user data; views count */

if (!isset($_SESSION["profile_view"]) or (isset($_SESSION["profile_view"]) and $_SESSION["profile_view"] != $row["id"])) {

myQ("UPDATE `[x]users` SET `views` = `views` + '1' WHERE `id`='{$row["id"]}'");

$_SESSION["profile_view"] = $row["id"];

 

Anybody know why it isn't working?? My guess is something to do with the sessions but I don't know what to change. Please Help...

Link to comment
https://forums.phpfreaks.com/topic/86060-view-count-issue/
Share on other sites

  if (!isset($_SESSION["profile_view"]) or (isset($_SESSION["profile_view"]) and $_SESSION["profile_view"] != $row["id"])) {
      myQ("UPDATE  `users` SET `views` = `views` + 1 WHERE `id`='{$row["id"]}'");
      $_SESSION["profile_view"] = $row["id"];

try ...

 

Link to comment
https://forums.phpfreaks.com/topic/86060-view-count-issue/#findComment-439500
Share on other sites

instead of using the typical way of querying you use a function which is myQ 

may be you need to post that function here..

or

 

inside your if statement echo anything so you know if your condition is being satisfied..

or

on your function myQ  find there  the function mysql_query and add a mysql error reporting in the end of that line

Link to comment
https://forums.phpfreaks.com/topic/86060-view-count-issue/#findComment-441581
Share on other sites

right now im not sure of anything. like i said we have to know the problem one by one

first check your ifs if it works then your query..

ok

  if (!isset($_SESSION["profile_view"]) or (isset($_SESSION["profile_view"]) and $_SESSION["profile_view"] != $row["id"])) {
      echo 'hi this is teng';
      myQ("UPDATE  `users` SET `views` = `views` + 1 WHERE `id`='{$row["id"]}'");
      $_SESSION["profile_view"] = $row["id"];
//missing code here

 

if it echo the added line i put then its your query or your function that has a problem..

its pretty hard to guess you need to look on all side of your code  ;)

Link to comment
https://forums.phpfreaks.com/topic/86060-view-count-issue/#findComment-441622
Share on other sites

I add your code and these are the errors that showed but these all showed before I started try to add all this.

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sites/spadespace.com/public_html/system/functions/database/mysql.fnc.php on line 37

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sites/spadespace.com/public_html/system/functions/database/mysql.fnc.php on line 37

Notice: Undefined variable: contactsCount in /home/sites/spadespace.com/public_html/modules/users/profile.php on line 625

Link to comment
https://forums.phpfreaks.com/topic/86060-view-count-issue/#findComment-442356
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.