Go Back   vb.org Archive > Community Central > Community Lounge
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 07-01-2004, 04:45 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Xenon
as i said, i don't find a way to do it in a query.

i don't think there is the needed function in mysql, or if it is, then i can't figure out the nae, so the only way i see right now to get the correct value would be a php/mysql combination
Ok, then, how would you do the combination?
Reply With Quote
  #12  
Old 07-01-2004, 05:00 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

aww, comeone, someone else please

ok, here you are, just snipets, not tested, nor implemented:

PHP Code:
$smilie_counts = array();
$posts $DB_site->query("
  SELECT smilietext, pagetext 
  FROM post, smilie 
  WHERE pagetext like concat("
%",smilie.smilietext,"%") 
"
);
while (
$post $DB_site->fetch_array($posts))
{
  
$smilie_counts["$post[smilietext]"] += substr_count($post['pagetext'], $post['smilietext']);

then $smilie_counts should contain the correct ammount of smilieusage for each smilie.
(at least if i didn't mess something up)
Reply With Quote
  #13  
Old 07-01-2004, 05:04 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I recall we discussed the very same thing before and I guess I offered a solution to add a new column to smilie table and populate it everytime a smilie is used while posting so that heavy load can be avoided.

Is it dejavu or am I dreaming?
Reply With Quote
  #14  
Old 07-01-2004, 05:06 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

definitelly a d?j?-vu pal

and iirc i said, that you ahve to populate the table as initialisation to get the real ammounts
Reply With Quote
  #15  
Old 07-01-2004, 06:26 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Then there is no real way to get the correct amount now?

Stefan, I tried your code and got a non-object error.
Reply With Quote
  #16  
Old 07-01-2004, 07:03 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What error exactly?
Reply With Quote
  #17  
Old 07-01-2004, 07:24 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

erm, i said code snipet Bob, not a full file

you have to require global.php before of course
Reply With Quote
  #18  
Old 07-01-2004, 07:29 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Doh! on me. Sorry about that.
Reply With Quote
  #19  
Old 07-01-2004, 08:22 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is what I am using and I get a Query is empty error:

PHP Code:
<?php
require_once('./global.php');
$smilie_counts = array();
$posts $DB_site->query("
  SELECT smilietext, pagetext 
  FROM post, smilie 
  WHERE pagetext like concat("
%",smilie.smilietext,"%") 
"
);
while (
$post $DB_site->fetch_array($posts))
{
  
$smilie_counts["$post[smilietext]"] += substr_count($post['pagetext'], $post['smilietext']);
}
echo 
"$smilie_counts";
?>
Reply With Quote
  #20  
Old 07-01-2004, 08:29 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

try that one:

PHP Code:
<?php
require_once('./global.php');
$smilie_counts = array();
$posts $DB_site->query("
  SELECT smilietext, pagetext 
  FROM post, smilie 
  WHERE pagetext like concat('%', smilie.smilietext, '%') 
"
);
while (
$post $DB_site->fetch_array($posts))
{
  
$smilie_counts["$post[smilietext]"] += substr_count($post['pagetext'], $post['smilietext']);
}
$output '';
foreach (
$smilie_counts AS $name => $val)
{
  
$output .= $name ' -> ' $val '<br />';
}

print_output($output);
?>
Reply With Quote
Reply


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. The time now is 11:10 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04018 seconds
  • Memory Usage 2,263KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete