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 761101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:47:53+00:00 2026-05-14T15:47:53+00:00

How do you use a php variable (array) inside a mysql select statement? I

  • 0

How do you use a php variable (array) inside a mysql select statement?

I am designing an auction site and currently working on a page that lets people view a list of all the current bids for an item. I want to display 3 columns:

  1. amountbid – the amount each bidder has bid for the item (held in tblbid)

  2. bidderid – the id of each bidder who has bid (found in tbluser)

  3. total_positivity_feedback – how many users have left positive feedback for the bidder (calculated from tblfeedback)

To find the ‘amount’ and the ‘bidderid’ columns i pass the essayid URL parameter from the previous page. This works fine.

Despite this, i can’t display the total_positivity_feedback column for the various users who have made each bid.

My mysql query looks like this:

select
tblbid.bidderid, 
tblbid.amount,
(select count(tblfeedback.feedbackid) from tblfeedback WHERE tblfeedback.writerid = "ARRAY VARIABLE GOES HERE") AS total_positivity_feedback FROM tblbid WHERE tblbid.essayid = $essayid_bids

I assume that the only way to accomplish this is to make the variable contain the bidderid’s of those people who bid for that particular essay? I can’t seem to work out how to do this tho?!?

Many thanks for your help

  • 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-05-14T15:47:54+00:00Added an answer on May 14, 2026 at 3:47 pm

    It’s not obvious from your problem where the Writer ID ought to come from. When you say “array”, do you mean a PHP array or are you referring multiple values stored in rows in the database? Your description suggests the former as you mention nothing about Writers in the database structure, but I suspect that you mean the latter.

    A value from an array can be insert into a PHP string quite simply:

    $arr = array("String");
    echo "{$arr[0]}";
    

    As I mentioned previously, I suspect that this won’t solve your problem. Could you please clarify the relation between the Bids and the Writers? If you are trying to get the feedback on each bidder then you’ll wanting something like:

    SELECT
        tblbid.bidderid, 
        tblbid.amount,
        (SELECT COUNT(tblfeedback.feedbackid) from tblfeedback WHERE tblfeedback.writerid = tblbid.bidderid) AS total_positivity_feedback
    FROM tblbid WHERE tblbid.essayid = $essayid_bids;
    

    Otherwise please explain further.

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

Sidebar

Ask A Question

Stats

  • Questions 418k
  • Answers 418k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Open your .svg file with a text editor (it's just… May 15, 2026 at 9:58 am
  • Editorial Team
    Editorial Team added an answer Anwser :) Play the loking task in AsyncTask inside doInBackground… May 15, 2026 at 9:58 am
  • Editorial Team
    Editorial Team added an answer This can't be done. For example, the Windows Task Manager,… May 15, 2026 at 9:58 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.