Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8896835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:10:44+00:00 2026-06-15T00:10:44+00:00

This is the page URL http://domain.com/testphp?id=1&mview=4 The choices are displayed from the table named

  • 0

This is the page URL
http://domain.com/testphp?id=1&mview=4

The choices are displayed from the table named
je_add_choice and it contains the field names

  1. choice_id
  2. poll_id
  3. choice_creator_id
  4. choice_name
  5. choice_image
  6. description
  7. Choicecreationtime

It displays the choices with their votes for the particular poll, what i want to do is, I have to display the choices orderby no of votes. But the problem is, The vote count for the choices are from another table named je_user_vote
and it contains the fields

  1. user_id
  2. Poll_id
  3. choice_id
  4. vote_id (primary key)
  5. datetime_voted
  6. usertype

In the poll page i used the query

select * from je_addchoice where poll_id='$poll_id'

In this query the $pollid variable is get from the url $_GET[‘id’]

I want to rewrite the query as

select * from je_addchoice where poll_id='$poll_id' // append the code order by count(fieldname) from je_user_vote table.

I already used

SELECT *, (
            SELECT count(*) 
            FROM je_uservote T2 
            WHERE T2.pollid=T1.pollID 
            AND T2.choiceid=T1.choiceID) AS votes
FROM je_addchoice T1
ORDER BY votes

But it shows the blank page. Anybody can help me for solve this problem. Thanks in advance for reading this and help me to solve

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:10:46+00:00Added an answer on June 15, 2026 at 12:10 am

    All you need is left join and aggregate function to calculate the vote. Here query you can try (untested):

    "SELECT COUNT(*) AS total_votes, t1.* 
    FROM je_add_choice t1
    LEFT JOIN je_user_vote t2
        ON t1.choice_id=t2.choice_id
        AND t1.poll_id=t2.Poll_id
    WHERE t1.poll_id = " . $poll_id . "
    GROUP BY t1.choice_id
    ORDER BY 1 ASC"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say my current URL is http://domain.com/category/cars/?page=2 How do I validate on this page
Let's say my current URL page is http://domain.com/listing.php?term=updated&page=7&more=new-user In this page have a link
I have these urls from a web log : http://www.domain.com/page?s=194&client=151678&m=a4a&v=1&g=54 http://www.domain.com/page?s=51&client=617171&m=b4z&v=8&g=97 How can I
I have the following url http://www.domain.com?page=options&tab=general I want to be able to get to
I have a url http://domain.com/shopname and the contents of this page has links created
Test Page URL: http://www.guygar.com/inception/ultra/indexCopy.html I am new to this and searching SO I found
I want to subscribe to a facebook page for example with this url ,http://www.myurl.com
My goal is to have the url routing as following: http://www.abc.com/this-is-peter-page http://www.abc.com/this-is-john-page What is
I am using a URL to query some posts by their ID. http://domain.com/page-name/?id=123 Visitors
I have a URL that displays a customer list like this: http://domain.com/pls/apex/f?p=724:2:820875406836801::::: The list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.