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 />";
}
Why don’t you do this: