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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:09:06+00:00 2026-06-13T07:09:06+00:00

Issue I’ve produced a query to determine the total cost per person for a

  • 0

Issue

I’ve produced a query to determine the total cost per person for a room and the total number of persons in the room; the total cost per person is returning correctly as is the total number of person in the room; however, when I try to echo the minor multiplication for the total, I am merely getting the display of the numbers I wish to multiply.

For example:
price per person = $1207
total number of person in the room = 2
query result … “1207*2” …

Question:

I’m certain it is something stupid or minor but could use a second set of eyes. How do I rewrite the code below to produce the desired result of $2414?

Here’s the query:

$tourquery = "SELECT t.roomprice, c.totpax 
         FROM clients c, tourprices t 
         WHERE c.roomtype1 = t.roomtype 
         AND c.tourstart = t.tourstart
         AND c.tourbk_id = t.tour_id"; 
$tourresult = $db->query($tourquery); 


while ($roomrate = mysqli_fetch_assoc($tourresult))
   {
echo "Per person amount : {$roomrate['roomprice']}<br />";
echo "Total room amount : {$roomrate['roomprice']}*{$roomrate['totpax']}<br />";

}
  • 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-13T07:09:07+00:00Added an answer on June 13, 2026 at 7:09 am

    Why don’t you do this:

    while ($roomrate = mysqli_fetch_assoc($tourresult))
    {
        $totalcost = $roomrate['roomprice'] * $roomrate['totpax'];
        echo "Per person amount : {$roomrate['roomprice']}<br />";
        echo "Total room amount : {$totalcost}<br />";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Issue: RODBC (falsely) returning zero rows Situation: I'm using RODBC to connect to a
// issue with the following not returning info or just stalling... but no errors
Issue I'm having is returning some data in a sidebar depending on which category
Issue The code does not correctly identify the input (item). It simply dumps to
issue facing while loading the messages in to mq channel, recieving an error like
Issue Using the following just simply doesn't work properly in -webkit- and -moz- browsers:
Issue for text elements that are adjacent to icon elements, the glyph height is
Issue Garbage gets erroneously entered into date fields and screws up calculations. Goal Using
Issue - We have a spreadsheet with thousands of addresses but no counties. Goal
Issue is SOLVED: Problem is that it is a pre-compiled web page project and

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.