Author Topic: Error in More than more Statistic  (Read 7760 times)

0 Members and 1 Guest are viewing this topic.

Offline glitzer

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • over 7000 E-Cards
Error in More than more Statistic
« on: March 21, 2005, 08:43:47 AM »
Can somebody help me, i get always the fault:

Code: [Select]
DB Error: Bad SQL Query: SELECT count(*) AS votes FROM VOTED_TABLE
Table 'xxxx.VOTED_TABLE' doesn't exist

DB Error: Bad SQL Query: SELECT count(*) AS votes FROM VOTED_TABLE WHERE vote_date >= 1111273200
Table 'xxxxx.VOTED_TABLE' doesn't exist

DB Error: Bad SQL Query: SELECT count(*) AS votes FROM VOTED_TABLE WHERE vote_date >= 1111186800 AND vote_date <= 1111273200
Table 'xxxx.VOTED_TABLE' doesn't exist

DB Error: Bad SQL Query: SELECT count(*) AS votes FROM VOTED_TABLE WHERE vote_date >= 1110754800
Table 'xxxx.VOTED_TABLE' doesn't exist

DB Error: Bad SQL Query: SELECT count(*) AS votes FROM VOTED_TABLE WHERE vote_date >= 1110150000 AND vote_date <= 1110754800
Table 'xxxx.VOTED_TABLE' doesn't exist

DB Error: Bad SQL Query: SELECT count(*) AS votes FROM VOTED_TABLE WHERE vote_date >= 1109631600
Table 'xxxxx.VOTED_TABLE' doesn't exist

DB Error: Bad SQL Query: SELECT count(*) AS votes FROM VOTED_TABLE WHERE vote_date >= 1107212400 AND vote_date <= 1109631600
Table 'xxxxx.VOTED_TABLE' doesn't exist

DB Error: Bad SQL Query: SELECT count(*) AS votes FROM VOTED_TABLE WHERE user_id >= 18 AND user_id <= 18
Table 'xxx.VOTED_TABLE' doesn't exist

I think i have to make a mysql table ..but i don´t how i do this.

Its not in the script bye "more than more statistiic"??!?

Thanx a lot.

P.s xxx i make for my pagename :)

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: Error in More than more Statistic
« Reply #1 on: March 21, 2005, 10:48:50 AM »
looks like if it asks for a table from a different modification ([MOD] Votes saved in DB)

The easiest way to fix it is to download the this file: Votes Saved in DB version A

upload the voted_a_install.php into the root of your page and open it in your browser...


The better solution would be to delet the MySQL query asking for voted_table...  :wink:
MAяTRIX


Offline glitzer

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • over 7000 E-Cards
Re: Error in More than more Statistic
« Reply #2 on: March 21, 2005, 12:03:52 PM »
I downloaded the Voted_a_install.php and opened it in my browser but i still get the error from above.

I cant find the MySQl query fro voted_table.

can somebody help me please ;(

Now i have the working stat.php:
Code: [Select]
<?PHP
//-----------------------------------------------------
//--- Show number of Users ----------------------------
//-----------------------------------------------------
   $sql = "SELECT COUNT(*) as users
          FROM ".USERS_TABLE."
          WHERE user_id <> ".GUEST;
  $row = $site_db->query_firstrow($sql);

  $total_users = "".$lang['users']."<B> ".$row['users']."</B>\n";
 
  $site_template->register_vars("total_users", $total_users);
unset($total_users);

//-----------------------------------------------------
//--- Hits --------------------------------------------
//-----------------------------------------------------
   $sql = "SELECT SUM(image_hits) AS sum
          FROM ".IMAGES_TABLE;
  $row = $site_db->query_firstrow($sql);

  $sum = (isset($row['sum'])) ? $row['sum'] : 0;
  $total_hits = "".$lang['total_hits']."<B> ".$row['sum']."</B>\n";
 
  $site_template->register_vars("total_hits", $total_hits);
unset($total_hits);

//-----------------------------------------------------
//--- Votes -------------------------------------------
//-----------------------------------------------------
   $sql = "SELECT SUM(image_votes) AS sum
          FROM ".IMAGES_TABLE;
  $row = $site_db->query_firstrow($sql);

  $sum = (isset($row['sum'])) ? $row['sum'] : 0;
  $total_votes = "".$lang['total_votes']."<B> ".$row['sum']."</B>\n";
 
  $site_template->register_vars("total_votes", $total_votes);
unset($total_votes);

//-----------------------------------------------------
//--- Downloads ---------------------------------------
//-----------------------------------------------------
   $sql = "SELECT SUM(image_downloads) AS sum
          FROM ".IMAGES_TABLE;
  $row = $site_db->query_firstrow($sql);

  $sum = (isset($row['sum'])) ? $row['sum'] : 0;
  $total_downloads = "".$lang['total_downloads']."<B> ".$row['sum']."</B>\n";
 
  $site_template->register_vars("total_downloads", $total_downloads);
unset($total_downloads);

//-----------------------------------------------------
//--- Comments ----------------------------------------
//-----------------------------------------------------
   $sql = "SELECT SUM(image_comments) AS sum
          FROM ".IMAGES_TABLE;
  $row = $site_db->query_firstrow($sql);

  $sum = (isset($row['sum'])) ? $row['sum'] : 0;
  $total_comments = "".$lang['total_comments']."<B> ".$row['sum']."</B>\n";
 
  $site_template->register_vars("total_comments", $total_comments);
unset($total_comments);
//-----------------------------------------------------
//--- New Member --------------------------------------
//-----------------------------------------------------
   $sql = "SELECT *
          FROM ".USERS_TABLE."
          WHERE user_id <> ".GUEST."
          ORDER by user_joindate DESC";
  $row = $site_db->query_firstrow($sql);

  $new_member = "Ein Herzliches Willkommen an unser neues Mitglied, ".(($row['user_id']) ? " <a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id'])."\"><B>".$row['user_name']."</B></a>\n" : "<B>".$row['user_name']."</B>");
  $site_template->register_vars("new_member", $new_member);
  unset($new_member);
?>

but i will use the stat for ...more Statistics with this Stats.php
Code: [Select]
<?PHP
//-----------------------------------------------------
//--- stats.php V1.1 by effemmess ---------------------
//--- based on Vraxor´s stats.php ---------------------
//--- for 4images V1.7 by Jan -------------------------
//-----------------------------------------------------

//-----------------------------------------------------
//--- Variableninitialisierung-------------------------
//-----------------------------------------------------
$time=time();
$m1 =60;
$h1 =$m1*60;
$T1 =$h1*24;
$T7 =$T1*7;
$T30=$T1*30;
(date("w",$time)==0) ? $date_w = 7 : $date_w = date("w",$time);


$ts_today_at_0           =mktime(0,0,0,date("m",$time),date("d",$time),date("Y",$time));
$ts_yesterday_at_0       =$ts_today_at_0-$T1;
$ts_1st_of_month         =mktime(0,0,0,date("m",$time),1,date("Y",$time));
$ts_1st_of_month_before  =mktime(0,0,0,date("m",$ts_1st_of_month-1),1,date("Y",$ts_1st_of_month-1));
$ts_this_monday          =$ts_today_at_0-$T1*($date_w-1);
$ts_last_monday          =$ts_this_monday-$T7;
$ts_24h_before           =$time-$T1;
$ts_7days_before         =$time-$T7;
$ts_30days_before        =$time-$T30;

//-----------------------------------------------------
//--- Funktionen --------------------------------------
//-----------------------------------------------------
function sql_add($from=0,$to=0,$field){
 $sql_add_from=$field." >= ".$from;
 $sql_add_to  =$field." <= ".$to;
 $sql_add = "";
 if ($from != 0 ||$to != 0){
   if ($from != 0) $sql_add .=$sql_add_from;
   if ($from != 0 && $to != 0) $sql_add .=" AND ";
   if ($to   != 0) $sql_add .=$sql_add_to;
 }
 return $sql_add;
}

function num_users($from=0,$to=0,$field="user_joindate"){
 global $site_db, $select_mode;

 if ($from != 0 ||$to != 0){
   $sql_where=" AND ";
 }
 $sql = "SELECT COUNT(*) as users
         FROM ".USERS_TABLE."
         WHERE user_id <> ".GUEST.$sql_where.sql_add($from,$to,$field);
 $row = $site_db->query_firstrow($sql);
 $num_users = $row['users'];
 return $num_users;
}
function num_votes_itable($from=0,$to=0,$field="image_date"){
 global $site_db, $select_mode;

 if ($from != 0 ||$to != 0){
   $sql_where=" WHERE ";
 }
 $sql = "SELECT SUM(image_votes) AS votes
         FROM ".IMAGES_TABLE.$sql_where.sql_add($from,$to,$field); 
 $row = $site_db->query_firstrow($sql);
 $num_votes = (isset($row['votes'])) ? $row['votes'] : 0;
 return $num_votes;
}
//-----------------------------------------------------
//--- Show number of Users ----------------------------
//-----------------------------------------------------
//total
 $total_users = num_users();
 $lang_total_users = $lang['users'];
 $lang_since_begin_new_users = $lang['since_begin_new_users'];
 $site_template->register_vars("total_users", $total_users);
 $site_template->register_vars("lang_total_users", $lang_total_users);
 $site_template->register_vars("lang_since_begin_new_users", $lang_since_begin_new_users);
 unset($total_users);
 unset($lang_total_users);
//today new
 $today_new_users = num_users($ts_today_at_0,0);
 $lang_today_new_users = $lang['today_new_users'];
 $site_template->register_vars("today_new_users", $today_new_users);
 $site_template->register_vars("lang_today_new_users", $lang_today_new_users);
 unset($today_new_users);
 unset($lang_today_new_users);
//yesterday new
 $yesterday_new_users = num_users($ts_yesterday_at_0,$ts_today_at_0);
 $lang_yesterday_new_users = $lang['yesterday_new_users'];
 $site_template->register_vars("yesterday_new_users", $yesterday_new_users);
 $site_template->register_vars("lang_yesterday_new_users", $lang_yesterday_new_users);
 unset($yesterday_new_users);
 unset($lang_yesterday_new_users);
//this week new
 $this_week_new_users = num_users($ts_this_monday,0);
 $lang_this_week_new_users = $lang['this_week_new_users'];
 $site_template->register_vars("this_week_new_users", $this_week_new_users);
 $site_template->register_vars("lang_this_week_new_users", $lang_this_week_new_users);
 unset($this_week_new_users);
 unset($lang_this_week_new_users);
//last week new
 $last_week_new_users = num_users($ts_last_monday,$ts_this_monday);
 $lang_last_week_new_users = $lang['last_week_new_users'];
 $site_template->register_vars("last_week_new_users", $last_week_new_users);
 $site_template->register_vars("lang_last_week_new_users", $lang_last_week_new_users);
 unset($last_week_new_users);
 unset($lang_last_week_new_users);
//this month new
 $this_month_new_users = num_users($ts_1st_of_month,0);
 $lang_this_month_new_users = $lang['this_month_new_users'];
 $site_template->register_vars("this_month_new_users", $this_month_new_users);
 $site_template->register_vars("lang_this_month_new_users", $lang_this_month_new_users);
 unset($this_month_new_users);
 unset($lang_this_month_new_users);
//last month new
 $last_month_new_users = num_users($ts_1st_of_month_before,$ts_1st_of_month);
 $lang_last_month_new_users = $lang['last_month_new_users'];
 $site_template->register_vars("last_month_new_users", $last_month_new_users);
 $site_template->register_vars("lang_last_month_new_users", $lang_last_month_new_users);
 unset($last_month_new_users);
 unset($lang_last_month_new_users);

//-----------------------------------------------------
//--- Votes -------------------------------------------
//-----------------------------------------------------
//total
 $total_votes = num_votes_vtable();
 $lang_total_votes = $lang['votes'];
 $lang_since_begin_new_votes = $lang['since_begin_new_votes'];
 $site_template->register_vars("total_votes", $total_votes);
 $site_template->register_vars("lang_total_votes", $lang_total_votes);
 $site_template->register_vars("lang_since_begin_new_votes", $lang_since_begin_new_votes);
 unset($total_votes);
 unset($lang_total_votes);
//today new
 $today_new_votes = num_votes_vtable($ts_today_at_0,0);
 $lang_today_new_votes = $lang['today_new_votes'];
 $site_template->register_vars("today_new_votes", $today_new_votes);
 $site_template->register_vars("lang_today_new_votes", $lang_today_new_votes);
 unset($today_new_votes);
 unset($lang_today_new_votes);
//yesterday new
 $yesterday_new_votes = num_votes_vtable($ts_yesterday_at_0,$ts_today_at_0);
 $lang_yesterday_new_votes = $lang['yesterday_new_votes'];
 $site_template->register_vars("yesterday_new_votes", $yesterday_new_votes);
 $site_template->register_vars("lang_yesterday_new_votes", $lang_yesterday_new_votes);
 unset($yesterday_new_votes);
 unset($lang_yesterday_new_votes);
//this week new
 $this_week_new_votes = num_votes_vtable($ts_this_monday,0);
 $lang_this_week_new_votes = $lang['this_week_new_votes'];
 $site_template->register_vars("this_week_new_votes", $this_week_new_votes);
 $site_template->register_vars("lang_this_week_new_votes", $lang_this_week_new_votes);
 unset($this_week_new_votes);
 unset($lang_this_week_new_votes);
//last week new
 $last_week_new_votes = num_votes_vtable($ts_last_monday,$ts_this_monday);
 $lang_last_week_new_votes = $lang['last_week_new_votes'];
 $site_template->register_vars("last_week_new_votes", $last_week_new_votes);
 $site_template->register_vars("lang_last_week_new_votes", $lang_last_week_new_votes);
 unset($last_week_new_votes);
 unset($lang_last_week_new_votes);
//this month new
 $this_month_new_votes = num_votes_vtable($ts_1st_of_month,0);
 $lang_this_month_new_votes = $lang['this_month_new_votes'];
 $site_template->register_vars("this_month_new_votes", $this_month_new_votes);
 $site_template->register_vars("lang_this_month_new_votes", $lang_this_month_new_votes);
 unset($this_month_new_votes);
 unset($lang_this_month_new_votes);
//last month new
 $last_month_new_votes = num_votes_vtable($ts_1st_of_month_before,$ts_1st_of_month);
 $lang_last_month_new_votes = $lang['last_month_new_votes'];
 $site_template->register_vars("last_month_new_votes", $last_month_new_votes);
 $site_template->register_vars("lang_last_month_new_votes", $lang_last_month_new_votes);
 unset($last_month_new_votes);
 unset($lang_last_month_new_votes);
//by 10<=user_id<=20 (example!)
 $from =18;
 $to   =18;
 $field="user_id";
 $user_id_votes = num_votes_vtable($from,$to,$field);
 $lang_user_id_votes = $lang['user_id_votes'];
 $site_template->register_vars("user_id_votes", $user_id_votes);
 $site_template->register_vars("lang_user_id_votes", $lang_user_id_votes);
 unset($user_id_votes);
 unset($lang_user_id_votes);
//by 1000<=image_id<=2000 (example!)
 $from =1000;
 $to   =2000;
 $field="image_id";
 $image_id_votes = num_votes_itable($from,$to,$field);
 $lang_image_id_votes = $lang['image_id_votes'];
 $site_template->register_vars("image_id_votes", $image_id_votes);
 $site_template->register_vars("lang_image_id_votes", $lang_image_id_votes);
 unset($image_id_votes);
 unset($lang_image_id_votes);

//-----------------------------------------------------
//--- Hits --------------------------------------------
//-----------------------------------------------------
 $sql = "SELECT SUM(image_hits) AS sum
         FROM ".IMAGES_TABLE;
 $row = $site_db->query_firstrow($sql);

 $sum = (isset($row['sum'])) ? $row['sum'] : 0;
 $total_hits = $row['sum'];
 $lang_total_hits = $lang['total_hits'];
 
 $site_template->register_vars("total_hits", $total_hits);
 $site_template->register_vars("lang_total_hits", $lang_total_hits);
 unset($total_hits);
 unset($lang_total_hits);

//-----------------------------------------------------
//--- Downloads ---------------------------------------
//-----------------------------------------------------
 $sql = "SELECT SUM(image_downloads) AS sum
         FROM ".IMAGES_TABLE;
 $row = $site_db->query_firstrow($sql);

 $sum = (isset($row['sum'])) ? $row['sum'] : 0;
 $total_downloads = $row['sum'];
 $lang_total_downloads = $lang['total_downloads'];
 
 $site_template->register_vars("total_downloads", $total_downloads);
 $site_template->register_vars("lang_total_downloads", $lang_total_downloads);
 unset($total_downloads);
 unset($lang_total_downloads);

//-----------------------------------------------------
//--- Comments ----------------------------------------
//-----------------------------------------------------
 $sql = "SELECT SUM(image_comments) AS sum
         FROM ".IMAGES_TABLE;
 $row = $site_db->query_firstrow($sql);

 $sum = (isset($row['sum'])) ? $row['sum'] : 0;
 $total_comments = $row['sum'];
 $lang_total_comments = $lang['total_comments'];
 
 $site_template->register_vars("total_comments", $total_comments);
 $site_template->register_vars("lang_total_comments", $lang_total_comments);
 unset($total_comments);
 unset($lang_total_comments);

 $lang_total_images = $lang['total_images'];
 $site_template->register_vars("lang_total_images", $lang_total_images);
 unset($lang_total_comments);
 $lang_total_categories = $lang['total_categories'];
 $site_template->register_vars("lang_total_categories", $lang_total_categories);
 unset($lang_total_categories);

//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
 $stats = $site_template->parse_template("stats_box");
 $site_template->register_vars("stats", $stats);
 unset($stats);
?>

But when i use the 2nd Stats.php i get this error.

THanx for everyone helP!!!!! :(

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: Error in More than more Statistic
« Reply #3 on: March 21, 2005, 01:04:45 PM »
well... then comment these lines out:

Code: [Select]
//today new
$today_new_votes = num_votes_vtable($ts_today_at_0,0);
$lang_today_new_votes = $lang['today_new_votes'];
$site_template->register_vars("today_new_votes", $today_new_votes);
$site_template->register_vars("lang_today_new_votes", $lang_today_new_votes);
unset($today_new_votes);
unset($lang_today_new_votes);
//yesterday new
$yesterday_new_votes = num_votes_vtable($ts_yesterday_at_0,$ts_today_at_0);
$lang_yesterday_new_votes = $lang['yesterday_new_votes'];
$site_template->register_vars("yesterday_new_votes", $yesterday_new_votes);
$site_template->register_vars("lang_yesterday_new_votes", $lang_yesterday_new_votes);
unset($yesterday_new_votes);
unset($lang_yesterday_new_votes);
//this week new
$this_week_new_votes = num_votes_vtable($ts_this_monday,0);
$lang_this_week_new_votes = $lang['this_week_new_votes'];
$site_template->register_vars("this_week_new_votes", $this_week_new_votes);
$site_template->register_vars("lang_this_week_new_votes", $lang_this_week_new_votes);
unset($this_week_new_votes);
unset($lang_this_week_new_votes);
//last week new
$last_week_new_votes = num_votes_vtable($ts_last_monday,$ts_this_monday);
$lang_last_week_new_votes = $lang['last_week_new_votes'];
$site_template->register_vars("last_week_new_votes", $last_week_new_votes);
$site_template->register_vars("lang_last_week_new_votes", $lang_last_week_new_votes);
unset($last_week_new_votes);
unset($lang_last_week_new_votes);
//this month new
$this_month_new_votes = num_votes_vtable($ts_1st_of_month,0);
$lang_this_month_new_votes = $lang['this_month_new_votes'];
$site_template->register_vars("this_month_new_votes", $this_month_new_votes);
$site_template->register_vars("lang_this_month_new_votes", $lang_this_month_new_votes);
unset($this_month_new_votes);
unset($lang_this_month_new_votes);
//last month new
$last_month_new_votes = num_votes_vtable($ts_1st_of_month_before,$ts_1st_of_month);
$lang_last_month_new_votes = $lang['last_month_new_votes'];
$site_template->register_vars("last_month_new_votes", $last_month_new_votes);
$site_template->register_vars("lang_last_month_new_votes", $lang_last_month_new_votes);
unset($last_month_new_votes);
unset($lang_last_month_new_votes);
//by 10<=user_id<=20 (example!)
$from =18;
$to   =18;
$field="user_id";
$user_id_votes = num_votes_vtable($from,$to,$field);
$lang_user_id_votes = $lang['user_id_votes'];
$site_template->register_vars("user_id_votes", $user_id_votes);
$site_template->register_vars("lang_user_id_votes", $lang_user_id_votes);
unset($user_id_votes);
unset($lang_user_id_votes);
//by 1000<=image_id<=2000 (example!)
$from =1000;
$to   =2000;
$field="image_id";
$image_id_votes = num_votes_itable($from,$to,$field);
$lang_image_id_votes = $lang['image_id_votes'];
$site_template->register_vars("image_id_votes", $image_id_votes);
$site_template->register_vars("lang_image_id_votes", $lang_image_id_votes);
unset($image_id_votes);
unset($lang_image_id_votes);

 :? :?:
MAяTRIX


Offline glitzer

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • over 7000 E-Cards
Re: Error in More than more Statistic
« Reply #4 on: March 21, 2005, 01:16:39 PM »
Thanx, but i think you dont understand me ;(


I want to have more statistics.. now i have only a little statistik with total users, total hits, total votes..

with the new statistic i want have to see..how many users..registers today, yesterday and so on...

now, when i comment the lines out, than i dont have more statistics...

 :cry:


Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: Error in More than more Statistic
« Reply #5 on: March 21, 2005, 01:23:56 PM »
I understood, but...

    ... just a hint for you...

If you try to install a MOD you should:

1) Follow step by step what the author recommends you to do!
Why?
Because:
Quote from: effemmess
Mindestvoraussetzungen:
- 4images 1.7
erweiterte Voraussetzungen (nicht zwingend erforderlich aber sehr hilfreich!):
- v@no´s Votes saved in DB
- effemmess´s Extension for Votes saved in DB
- effemmess´s Old votes 2 DB

If you did not install the modifications above, then you can't have more votes-statistics, because 4images doesn't save the needed votes-information by default...
So you have 2 alternatives:
* comment (not use) the additional votes-statistics
* install the above mods

2) Ask in the mod-thread if you have a problem with getting it to work
and not open a new thread for that question / or even ask the same question twice in two differen threads  :wink:

If you comment the mentioned lines out, then you'll still have more statistics about images and users eg but not about votes - without the needed modifications you do not have the needed data  8O
MAяTRIX


Offline glitzer

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • over 7000 E-Cards
Re: Error in More than more Statistic
« Reply #6 on: March 21, 2005, 01:32:15 PM »
 thanx for your quick help Martrix

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: Error in More than more Statistic
« Reply #7 on: March 21, 2005, 03:26:50 PM »
and did you get it to work?  :D
MAяTRIX


Offline glitzer

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • over 7000 E-Cards
Re: Error in More than more Statistic
« Reply #8 on: March 21, 2005, 04:18:24 PM »
yes. it works.. :D

but only the stats for the users ( today, yesterday, this month) ...
but its ok...this it is was i like :)

thanks a lot for your patient. :wink:

Glitzer

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: Error in More than more Statistic
« Reply #9 on: March 21, 2005, 11:35:55 PM »
nice :)

But you may still implement the modifications recomended by effemmess and the votes-stats will then be also available...
MAяTRIX