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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:18:11+00:00 2026-06-13T19:18:11+00:00

I have a loop in PHP as follows: $getDetails = mssql_query (SELECT * FROM

  • 0

I have a loop in PHP as follows:

$getDetails = mssql_query ("SELECT * FROM BasketItems 
WHERE BasketID = '".$_GET['id']."' ");

while ($detailsrow = mssql_fetch_array($getDetails)) {     
  $TotalSetPrice = $detailsrow['FinalPrice'] * $detailsrow['Qty'];
  echo $TotalSetPrice;

  $numberofent = count($detailsrow['FinalPrice']);
  echo "######NUMBER#####: $numberofent";

  $TotalPrice = ?????;

  ######VARIOUS DATA##############
}

So ok i’m not an expert at PHP by any means, thats the first thing. FinalPrice is the price of an item in the DB that someone has selected. However the customer can have any number of quantity of those items.

So FinalPrice * Qty = TotalSetPrice

However the customer may also have different sets of items within the basket.

So I need to calculate TotalSetPrice * (Number of sets of items Within the DB)

SO I googled, and came up with count(), but if I just count($detailsrow) it returns 56 entries, this is the number of overall pieces of data if that makes sense. I just want to count the dumber of actual data sets. I tried counting finalprice but that just returns 1, which isn’t correct either.

Can anyone give me some guidence on how you are meant to count the number of entries in an array loop such as this. I hope that makes more sense than I feel it does.

  • 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-13T19:18:12+00:00Added an answer on June 13, 2026 at 7:18 pm

    SELECT FinalPrice, Qty,(FinalPrice * Qty) AS TotalSetPrice

    Just use mysql, so that you no longer use with php which you will need to write a longer code

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

Sidebar

Related Questions

So I have a php foreach loop as follows, $i = 1; foreach($rows as
I have a PHP while loop as follow: <?php while (have_posts()) : the_post(); ?>
I have a while loop getting info from a MySQL db, outputting info via
I have a Wordpress loop as follows: <?php $loop = new WP_Query( array( 'post_type'
I have a while loop in php that fetches results of a query (a
In wordpress, I have the loop.php file. There I can see the 'read more'
I have a php loop that is echoing out geolocation values. How can I
i have a php loop which displays only one record even if there is
Alright i have a for loop in php and it generates a group of
Using for loop in PHP can we have numbers associate with a variable name?

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.