Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Mysql

Parašė Vaidotas-· 2008 Vas. 22 16:02:36
#1

Sveiki, turiu point system, ir jį noriu integruot į nario lygį, tačiau kai pridedu kodą :
$reward = dbcount("(points_rew)", "points_user", "user_id='$exp_user'");


rodo ne ką kitą, kaip user Id, kaip reikia padaryt, kad, rodytų nario taškų skaičių.

points_rew <-- Taškų skaičius
user_id <-- nario kodas

Pagrindinė lantelė: points_user

Redagavo ozzWANTED· 2008 Vas. 22 16:02:59

Parašė Vaidotas-· 2008 Vas. 22 16:02:49
#2

Sorry už flood, bet gal padės labaiu, jei damesiu


if (iMEMBER) {
      $row = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='1'");
        $points=dbarray($row);
        $points_thread = $points['points'];
       
        $row2 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='2'");
        $points2=dbarray($row2);
        $points_post = $points2['points'];
       
        $row3 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='3'");
        $points3=dbarray($row3);
        $points_link = $points3['points'];
       
        $row4 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='4'");
        $points4=dbarray($row4);
        $points_article = $points4['points'];
       
        $row5 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='5'");
        $points5=dbarray($row5);
        $points_news = $points5['points'];
   
      $row9 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='9'");
        $points9=dbarray($row9);
        $points_shoutbox = $points9['points'];
      
      $row10 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='10'");
        $points10=dbarray($row10);
        $points_kommentare = $points10['points'];
      
      $row12 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='12'");
        $name12=dbarray($row12);
        $name_name = $name12['name'];
      
      $row1 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='1'");
        $status1=dbarray($row1);
        $status1 = $status1['status'];
      $row2 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='2'");
        $status2=dbarray($row2);
        $status2 = $status2['status'];
      $row3 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='3'");
        $status3=dbarray($row3);
        $status3 = $status9['status'];
      $row4 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='4'");
        $status4=dbarray($row4);
        $status4 = $status4['status'];
       $row5 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='5'");
        $status5=dbarray($row5);
        $status5 = $status5['status'];
       $row9 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='9'");
        $status9=dbarray($row9);
        $status9 = $status9['status'];
       $row10 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='10'");
        $status10 =dbarray($row10);
        $status10 = $status10['status'];
       $row11 = dbquery("SELECT * FROM ".$db_prefix."points WHERE id='11'");
        $status11 =dbarray($row11);
        $status11 = $status11['status'];

      
   $row= dbquery("SELECT * FROM ".$db_prefix."points_user  WHERE user_id='".$userdata['user_id']."'");   
   $reward=dbarray($row);
   $reward = $reward['points_rew'];
   $row= dbquery("SELECT * FROM ".$db_prefix."points_user  WHERE user_id='".$userdata['user_id']."'");   

   $strafe =dbarray($row);
   $strafe = $strafe ['points_str'];
   $row= dbquery("SELECT * FROM ".$db_prefix."points_user  WHERE user_id='".$userdata['user_id']."'");   
   $extra=dbarray($row);
   $extra= $extra['points_ext'];
   $row= dbquery("SELECT * FROM ".$db_prefix."points_user  WHERE user_id='".$userdata['user_id']."'");   
   $ausgabe=dbarray($row);
   $ausgabe= $ausgabe['points_aus'];
      
            $shoutboxzahl =dbcount("(shout_id)", "shoutbox", "shout_name='".$userdata['user_id']."'");
      $articlezahl =dbcount("(article_id)", "articles", "article_name='".$userdata['user_id']."'");
      $newszahl =dbcount("(news_id)", "news", "news_name='".$userdata['user_id']."'");
      $kommentarezahl =dbcount("(comment_id)", "comments", "comment_name='".$userdata['user_id']."'");
      $threadzahl =dbcount("(forum_id)", "threads", "thread_author='".$userdata['user_id']."'");
      $postzahl = dbcount("(post_id)", "posts", "post_author='".$userdata['user_id']."'");
      
      if($status5== 1){
      $newsall="$newszahl "*" $points_news  ";   
      }
      if($status9== 1){
      $shoutboxall="$shoutboxzahl "*" $points_shoutbox  ";   
      }
      if($status4== 1){
      $articleall="$articlezahl  "*" $points_article";   
      }
      if($status10== 1){
      $kommentarall="$kommentarezahl  "*"  $points_kommentare    ";   
      }
      if($status1== 1){
      $threadall=" $threadzahl "*" $points_thread ";   
      }
      if($status2== 1){
      $postall="$postzahl "*" $points_post ";
      }
      if($status11== 1){
      $reward2="$reward";
      }
opentable("".PS_000."");

echo"<table align='center' width='408' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td width='50%' align='left' class='tbl2'><b>".PS_012."</b></td>
<td width='50%' align='lefr' class='tbl2'><b>$name_name</b></td>
</tr>\n";
if($status9 == 1){
echo "<tr><td class='tbl'>".PS_001."</td><td class='tbl' colspan='2'>";
echo dbcount("(shout_id)", "shoutbox", "shout_name='".$userdata['user_id']."'")."".PS_007."   $points_shoutbox = $shoutboxall </td></tr> ";
}

if($status4 == 1){
echo "<tr>\n<td class='tbl'>".PS_002."</td>\n<td class='tbl' colspan='2'>\n";
echo dbcount("(article_id)", "articles", "article_name='".$userdata['user_id']."'")."".PS_007."   $points_article =  $articleall  </td></tr> ";
}

if($status5 == 1){
echo "<tr>\n<td class='tbl'>".PS_009."</td>\n<td class='tbl' colspan='2'>\n";
echo dbcount("(news_id)", "news", "news_name='".$userdata['user_id']."'")."".PS_007.   "$points_news =  $newsall  </td></tr> ";
}

if($status10 ==  1){
echo "<tr>\n<td class='tbl'>".PS_004."</td>\n<td class='tbl' colspan='2'>\n";
echo dbcount("(comment_id)", "comments", "comment_name='".$userdata['user_id']."'")." ".PS_007.   "$points_kommentare = $kommentarall</td></tr> ";
}

if($status1 == 1){
echo "<tr>\n<td class='tbl'>".PS_011."</td>\n<td class='tbl' colspan='2'>\n";
echo dbcount("(forum_id)", "threads", "thread_author='".$userdata['user_id']."'")." ".PS_007.   "$points_thread = $threadall </td></tr> ";
}

if($status2== 1){
echo "<tr>\n<td class='tbl'>".PS_003."</td>\n<td class='tbl' colspan='2'>\n";
echo dbcount("(post_id)", "posts", "post_author='".$userdata['user_id']."'")." ".PS_007.   "$points_post = $postall  </td></tr> ";
}
if($status11== 1){
echo "<tr>\n<td class='tbl'>".PS_018."</td>\n<td class='tbl' colspan='2'>\n"; echo "$reward    </td></tr> ";
}
$gesamtzahl = "$shoutboxall "+" $articleall "+" $newsall "+" $kommentarall "+"  $postall "+" $threadall "+" $reward2  ";
$guthaben = "$shoutboxall "+" $articleall "+" $newsall "+" $kommentarall "+"  $postall "+" $threadall "+" $reward2 "+" $extra "-" $ausgabe "-" $strafe";

echo "<tr><td class='tbl' colspan='2'><hr>\n</td></tr> ";
echo "<tr>\n<td class='tbl'>\n \n".PS_008." </td><td class='tbl' colspan='2'>$gesamtzahl</td></tr> ";
echo "<tr><td class='tbl' colspan='2'><hr>\n</td></tr> ";
echo "<tr>\n<td class='tbl'>\n \n".PS_013."$name_name:</td> <td class='tbl' colspan='2'>$extra\n</td></tr> ";
echo "<tr>\n<td class='tbl'>\n \n".PS_014." </td><td class='tbl' style='color: #FF0000' colspan='2'>$ausgabe\n</td></tr> ";
echo "<tr>\n<td class='tbl'>\n \n".PS_015." </td><td class='tbl' style='color: #FF0000' colspan='2'>$strafe\n</td></tr> ";
echo "<tr><td class='tbl' colspan='2'><hr>\n</td></tr> ";
echo "<tr><td class='tbl' colspan='2'><hr>\n</td></tr> ";

   $row=  dbquery("SELECT * FROM ".$db_prefix."points_user WHERE user_id='".$userdata['user_id']."'");   
   $guthabendb=dbarray($row);
   $guthabendb = $guthabendb['points_ges'];

if( $guthaben <= -1)
{
echo "<tr>\n<td class='tbl'>\n \n".PS_016." </td><td class='tbl' style='color: #FF0000' colspan='2'>$guthabendb\n</td></tr> ";
}
else{
echo "<tr>\n<td class='tbl'>\n \n".PS_016." </td><td class='tbl' colspan='2'>$guthabendb\n</td></tr> ";
}
echo "<tr><td class='tbl' colspan='2'><hr>\n</td></tr> ";
echo "</table>\n";
closetable();
echo "<br>";









ir čia failas, kur reikia jį įdėt


<?php

if (!defined("IN_FUSION")) { header("Location:../index.php"); exit; }




function showexp($exp_user,$exp_posts,$exp_type) {







      if (iMEMBER) {

         $posts = $exp_posts;
         $comment = dbcount("(comment_id)", "comments", "comment_name='$exp_user'");
         $rating = dbcount("(rating_id)", "ratings", "rating_user='$exp_user'");
         
   
         $sum = ($posts+$comment+$shoutbox+$rating+$mod+$reward);
   

   if ($sum <= "1") {$rang = "0";$level = "Naujokas";}
   if ($sum >= "1") {$rang = "5";$level = "Pradinukas";}
   if ($sum >= "5") {$rang = "25";$level = "Apšylantis";}
   if ($sum >= "25") {$rang = "50";$level = "D Chemikas";}
   if ($sum >= "50") {$rang = "100";$level = "C Chemikas";}
   if ($sum >= "100") {$rang = "250";$level = "B Chemikas";}
   if ($sum >= "250") {$rang = "500";$level = "A Chemikas";}
   if ($sum >= "500") {$rang = "1000";$level = "Mokytojas";}
   if ($sum >= "1000") {$rang = "2000";$level = "Profesorius";}
   if ($sum >= "2000") {$rang = "4000";$level = "Viršininkas";}
   if ($sum >= "4000") {$rang = "10000";$level = "Viršininkas kvadratu";}
   $poll_posts = $rang;
   $opt_posts = ($poll_posts ? number_format(100 / $poll_posts * $sum) : 0);
   
      if ($exp_type == "1") {
echo"<br>Lygis: <b>$level</b>
<br>Iki kito: [$opt_posts%]
<br>

   <table width='100%' border='1' class='line'><tr><th width='100%'>
   <img src='".IMAGES."line.gif' title='Procentine linija' height='8' width='$opt_posts%' align='left' >
   </td></tr></table>

<br>Pranešimų forume: <b>$posts</b>
<br>Komentarų: <b>$comment</b>
<br>Klausimynas: <b>$reward</b>

";

      }

   }
}

?>







$row= dbquery("SELECT * FROM ".$db_prefix."points_user WHERE user_id='".$userdata['user_id']."'");
$reward=dbarray($row);
$reward = $reward['points_rew'];
$row= dbquery("SELECT * FROM ".$db_prefix."points_user WHERE user_id='".$userdata['user_id']."'");


Čia tas kodas, kuris turėtų sudaryt pagrindą

Redagavo Vaidotas-· 2008 Vas. 22 17:02:03