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

  • SEARCH
  • Home
  • 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 8850947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:01:13+00:00 2026-06-14T13:01:13+00:00

I am blocked on a hard request to my database in php…. I would

  • 0

I am blocked on a hard request to my database in php….

I would lik to display on my page a list the 10 persons (name/surname) that :
– have answered “1” to 3 questions (question1/question2/question3)
– and have answered at the question4 the closest number of participations (positive or negative sens)

Well i know how to determine my global number of paticipation :

$query_count = "SELECT COUNT(*) AS Nb FROM my_table";    
$result_count = mysql_query($query_count) or die(mysql_error());

while($row = mysql_fetch_array($result_count)){
    echo "Participations :  ". $row['Nb'];
    echo "<br />";
    $count = $row['Nb']; // i create a $count var for next steps

Then i know how to display a request in table :

$query = "SELECT id,name,surname FROM my_table ORDER BY id"; 
$result = mysql_query($query);


// Recuperation des resultats
while($row = mysql_fetch_row($result)){
        $id = $row[0];
        $name = $row[1];
        $surname = $row[2];



        echo "<tr>\n
        <td>$id</td>\n
        <td>$name</td>\n
        <td>$surname</td>\n
        </tr>\n";

    }

But in my $query i don’t know how to say :
show the 10 row WITH name,surname AND answer=1 to question1,2and3 AND
question4 is closer to number of participations (less, equal or more)

Do you have an idea?

Thanks!!!

  • 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-14T13:01:14+00:00Added an answer on June 14, 2026 at 1:01 pm

    The first part of your question is elementary: WHERE answer IN (1,2,3) after you make the appropriate join. Since I don’t have your full schema I can’t help with specifics, but here is a rough example:

    SELECT u.user_name_first, u.user_name_last FROM user u LEFT JOIN
    answers a ON u.user_id = a.user_id WHERE a.answer_id IN (1,2,3);

    The second half is vague. Please clarify what you mean by “closer to number of participations (less, equal or more)”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before this question is blocked for duplication, I would like to mention is that
can cookies be blocked using a page directive instead of doing it programmatic?
I have members that can be blocked and when the member is blocked I
I'm facing a problem that gives me a quite hard time ... People having
I'm getting blocked on a jsp page and our 1 java engineer isn't able
I'm blocked with a very simple Query that it's not working as I think
I have a C# module responsible for acquiring the list of network adapters that
I have a datetime query that works qreat: $q=SELECT COUNT(blocked) AS sum_blocked, DATE(created) AS
I have a table which contains a list of blocked words +--------+------------------+ | id
Apple have long blocked mobile Safari from playing sounds – the usual JavaScript commands

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.