HELP : How can i make This Code ???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    HELP : How can i make This Code ???

    In Lavalair poll .....

    if "michel" voted..
    output will be: Michel Voted Here !

    or if michel, habib, rahul(the last voter of poll) voted there ..
    output will be : rahul and 2 other people voted here !

    How can i make This Code ???
    Can AnyOne Help meh about it Plz ???
    Plz Reply !!

    #2
    I duno ur schema bt heres an inexistent way
    PHP Code:
    $query mysql_fetch_objectmysql_query"SELECT * FROM table ORDER BY id, created_time" ) );
    $num_users count$query );
    $last_id = ( $num_users ) ? $query[0]->user_id false;
    if( 
    $num_users )
    $text ':user and :count other :people did this thing.';
    elseif( 
    $num_users === )
    $text ':user did this';
    else
    $text null;

    $last_uname = ( $text ) ? id_to_username$last_id ) : null// ID to name function maybe
    $text strtr$text, array( ':user' => $last_uname':count' => $num_users':people' => ( $num_users === ) ? 'person' 'people' ) );

    echo 
    $text

    Comment


      #3
      Not Working !!!

      my poll Table is here :
      Code:
      --
      -- Table structure for table `ibwf_presults`
      --
      
      CREATE TABLE IF NOT EXISTS `ibwf_presults` (
        `id` int(100) NOT NULL AUTO_INCREMENT,
        `pid` int(100) NOT NULL DEFAULT '0',
        `uid` int(100) NOT NULL DEFAULT '0',
        `ans` int(10) NOT NULL DEFAULT '0',
        PRIMARY KEY (`id`)
      ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=57 ;
      PLZ help meh !!!!

      Comment


        #4
        ive got something similar here this is my forums poll and the likes
        Code:
        else if($action=="viewpl")
        {
          $who = cleanQuery($_GET["who"]);
          addonline(getuid_sid($sid),"Viewing A Users Poll","");
            echo "<head>";
            echo "<title>View Poll</title>";
            echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
            echo "</head>";
            echo "<body>";
            echo "<p>";
            $uid = getuid_sid($sid);
            $pollid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$who."'"));
            if($pollid[0]>0)
            {
                $polli = mysql_fetch_array(mysql_query("SELECT id, pqst, opt1, opt2, opt3, opt4, opt5, pdt FROM ibwf_polls WHERE id='".$pollid[0]."'"));
                if(trim($polli[1])!="")
                {
                    $qst = parsepm($polli[1], $sid);
                    echo $qst."<br/><br/>";
                    $vdone = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE uid='".$uid."' AND pid='".$pollid[0]."'"));
                    $nov = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."'"));
                    $nov = $nov[0];
                    if($vdone[0]>0)
                    {
                      $voted= true;
                    }else{
                      $voted = false;
                    }
                    $opt1 = $polli[2];
                    if (trim($opt1)!="")
                    {
                      $opt1 = htmlspecialchars($opt1);
                      $nov1 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='1'"));
                      $nov1 = $nov1[0];
                      if($nov>0)
                      {
                      $per = floor(($nov1/$nov)*100);
                      $rests = "Votes: $nov1($per%)";
                      }else{
                        $rests = "Votes: 0(0%)";
                      }
                        if($voted)
                        {
                          $lnk = "1.$opt1 <small>$rests</small><br/>";
                        }else{
                      $lnk = "1.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=1\">$opt1</a> <small>$rests</small><br/>";
                      }
                      echo "$lnk";
                    }
                    $opt2 = $polli[3];
                    if (trim($opt2)!="")
                    {
                      $opt2 = htmlspecialchars($opt2);
                      $nov2 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='2'"));
                      $nov2 = $nov2[0];
                      if($nov>0)
                      {
                      $per = floor(($nov2/$nov)*100);
                      $rests = "Votes: $nov2($per%)";
                      }else{
                        $rests = "Votes: 0(0%)";
                      }
                      if($voted)
                        {
                          $lnk = "2.$opt2 <small>$rests</small><br/>";
                        }else{
                      $lnk = "2.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=2\">$opt2</a> <small>$rests</small><br/>";
                      }
                      echo "$lnk";
                    }
                    $opt3 = $polli[4];
                    if (trim($opt3)!="")
                    {
                      $opt3 = htmlspecialchars($opt3);
                      $nov3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='3'"));
                      $nov3 = $nov3[0];
                      if($nov>0)
                      {
                      $per = floor(($nov3/$nov)*100);
                      $rests = "Votes: $nov3($per%)";
                      }else{
                        $rests = "Votes: 0(0%)";
                      }
                      if($voted)
                        {
                          $lnk = "3.$opt3 <small>$rests</small><br/>";
                        }else{
                      $lnk = "3.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=3\">$opt3</a> <small>$rests</small><br/>";
                      }
                      echo "$lnk";
                    }
                    $opt4 = $polli[5];
                    if (trim($opt4)!="")
                    {
                      $opt4 = htmlspecialchars($opt4);
                      $nov4 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='4'"));
                      $nov4 = $nov4[0];
                      if($nov>0)
                      {
                      $per = floor(($nov4/$nov)*100);
                      $rests = "Votes: $nov4($per%)";
                      }else{
                        $rests = "Votes: 0(0%)";
                      }
                      if($voted)
                        {
                          $lnk = "4.$opt4 <small>$rests</small><br/>";
                        }else{
                      $lnk = "4.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=4\">$opt4</a> <small>$rests</small><br/>";
                      }
                      echo "$lnk";
                    }
                    $opt5 = $polli[6];
                    if (trim($opt5)!="")
                    {
                      $opt5 = htmlspecialchars($opt5);
                      $nov5 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='5'"));
                      $nov5 = $nov5[0];
                      if($nov>0)
                      {
                      $per = floor(($nov5/$nov)*100);
                      $rests = "Votes: $nov5($per%)";
                      }else{
                        $rests = "Votes: 0(0%)";
                      }
                      if($voted)
                        {
                          $lnk = "5.$opt5 <small>$rests</small><br/>";
                        }else{
                      $lnk = "5.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=5\">$opt5</a> <small>$rests</small><br/>";
                      }
                      echo "$lnk";
                    }
                    echo "<small>".date("d m y - H:i",$polli[7])."</small>";
                }else{
                    echo "<img src=\"../images/notok.gif\" alt=\"x\"/>This poll doesn't exist";
                }
            }else{
                echo "<img src=\"../images/notok.gif\" alt=\"x\"/>This user have no poll";
            }
            echo "</p>";
            echo "<p align=\"center\">";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">© $sitename</a>";
          echo "</p>";
          echo "</body>";
        
        }
        
        else if($action=="viewtpl")
        {
          $who = cleanQuery($_GET["who"]);
          addonline(getuid_sid($sid),"Viewing a poll","");
            echo "<head>";
            echo "<title>View Poll</title>";
            echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
            echo "</head>";
            echo "<body>";
            echo "<p>";
            $uid = getuid_sid($sid);
            $pollid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_topics WHERE id='".$who."'"));
            if($pollid[0]>0)
            {
                $polli = mysql_fetch_array(mysql_query("SELECT id, pqst, opt1, opt2, opt3, opt4, opt5, pdt FROM ibwf_polls WHERE id='".$pollid[0]."'"));
                if(trim($polli[1])!="")
                {
                    $qst = parsepm($polli[1], $sid);
                    echo $qst."<br/><br/>";
                    $vdone = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE uid='".$uid."' AND pid='".$pollid[0]."'"));
                    $nov = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."'"));
                    $nov = $nov[0];
                    if($vdone[0]>0)
                    {
                      $voted= true;
                    }else{
                      $voted = false;
                    }
                    $opt1 = $polli[2];
                    if (trim($opt1)!="")
                    {
                      $opt1 = htmlspecialchars($opt1);
                      $nov1 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='1'"));
                      $nov1 = $nov1[0];
                      if($nov>0)
                      {
                      $per = floor(($nov1/$nov)*100);
                      $rests = "Votes: $nov1($per%)";
                      }else{
                        $rests = "Votes: 0(0%)";
                      }
                        if($voted)
                        {
                          $lnk = "1.$opt1 <small>$rests</small><br/>";
                        }else{
                      $lnk = "1.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=1\">$opt1</a> <small>$rests</small><br/>";
                      }
                      echo "$lnk";
                    }
                    $opt2 = $polli[3];
                    if (trim($opt2)!="")
                    {
                      $opt2 = htmlspecialchars($opt2);
                      $nov2 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='2'"));
                      $nov2 = $nov2[0];
                      if($nov>0)
                      {
                      $per = floor(($nov2/$nov)*100);
                      $rests = "Votes: $nov2($per%)";
                      }else{
                        $rests = "Votes: 0(0%)";
                      }
                      if($voted)
                        {
                          $lnk = "2.$opt2 <small>$rests</small><br/>";
                        }else{
                      $lnk = "2.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=2\">$opt2</a> <small>$rests</small><br/>";
                      }
                      echo "$lnk";
                    }
                    $opt3 = $polli[4];
                    if (trim($opt3)!="")
                    {
                      $opt3 = htmlspecialchars($opt3);
                      $nov3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='3'"));
                      $nov3 = $nov3[0];
                      if($nov>0)
                      {
                      $per = floor(($nov3/$nov)*100);
                      $rests = "Votes: $nov3($per%)";
                      }else{
                        $rests = "Votes: 0(0%)";
                      }
                      if($voted)
                        {
                          $lnk = "3.$opt3 <small>$rests</small><br/>";
                        }else{
                      $lnk = "3.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=3\">$opt3</a> <small>$rests</small><br/>";
                      }
                      echo "$lnk";
                    }
                    $opt4 = $polli[5];
                    if (trim($opt4)!="")
                    {
                      $opt4 = htmlspecialchars($opt4);
                      $nov4 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='4'"));
                      $nov4 = $nov4[0];
                      if($nov>0)
                      {
                      $per = floor(($nov4/$nov)*100);
                      $rests = "Votes: $nov4($per%)";
                      }else{
                        $rests = "Votes: 0(0%)";
                      }
                      if($voted)
                        {
                          $lnk = "4.$opt4 <small>$rests</small><br/>";
                        }else{
                      $lnk = "4.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=4\">$opt4</a> <small>$rests</small><br/>";
                      }
                      echo "$lnk";
                    }
                    $opt5 = $polli[6];
                    if (trim($opt5)!="")
                    {
                      $opt5 = htmlspecialchars($opt5);
                      $nov5 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='5'"));
                      $nov5 = $nov5[0];
                      if($nov>0)
                      {
                      $per = floor(($nov5/$nov)*100);
                      $rests = "Votes: $nov5($per%)";
                      }else{
                        $rests = "Votes: 0(0%)";
                      }
                      if($voted)
                        {
                          $lnk = "5.$opt5 <small>$rests</small><br/>";
                        }else{
                      $lnk = "5.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=5\">$opt5</a> <small>$rests</small><br/>";
                      }
                      echo "$lnk";
                    }
                    echo "<small>".date("d m y - H:i",$polli[7])."</small>";
                }else{
                    echo "<img src=\"../images/notok.gif\" alt=\"x\"/>This poll doesn't exist";
                }
            }else{
                echo "<img src=\"../images/notok.gif\" alt=\"x\"/>This user have no poll";
            }
            echo "</p>";
            echo "<p align=\"center\">";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">© $sitename</a>";
          echo "</p>";
          echo "</body>";
        
        }
        it will give u an idea how to go about displaying the users etc









        Dont Ask Me Dumb Questions.Or you'l get a Dumb Answer..
        Want A Profesional Logo or Theme For Your wap site Pm Me.If I Have The Time Ill Make It For Free

        Comment


          #5
          Thanks ozziemale !
          m did it successfully !!!!

          Comment

          Working...
          X