1
Good afternoon, it is the following in my project I need to do an account so at the end have the result for the customer know how much to pay, but I am not able to do this account.
In my case, I ask for the days and then the room will have a price (which in this case is already registered in mysql) and I want to fetch this data from mysql and do the account for example (amount = price * days).
<html>
Data sent
<div id="middle">
<br><br><p>Obrigado pela sua preferência!</p>
<p>A partir deste momento, tem 24 horas para efetuar o pagamento e completar a sua estadia.</p>
Entity:
00000
<tr>
<td>Referência:</td>
<td>000 000 000</td>
</tr>
<tr>
<td>Montante:</td>
<td><?php $montante; ?>€</td>
</tr>
</table>
$sql = "select preco from casa Where num_casa = 1"; $result = mysqli_query($con, $sql); $Row = mysqli_fetch_array($result);
//Form variables $name=$_POST['name']; $surname=$_POST['surname']; $email=$_POST['email']; $phone=$_POST['phone']; $contributor=$_POST['contributor']; $cc=$_POST['cc']; $address=$_POST['address']; $data_input=$_POST['data_input']; $data_saida=$_POST['data_saida'];
$price = $Row["price"];
$difference = strtotime($data_output) - strtotime($data_input); $num_days = floor($difference / (60*60*24));
$amount = ($num_days * $price);
echo "Name: ".$name."
";
echo "Surname: ".$surname."
";
echo "E-mail: ".$email."
";
echo "Telephone: ".$telephone."
";
echo "Taxpayer: ".$taxpayer."
";
echo "Citizen Card: ".$cc."
";
echo "Address: ".$address."
";
echo "Date entered: ".$data_input."
";
echo "Date left: ".$dating."
";
echo "Number of days: ".$in a few days."
";
//It will record the data entered by the user
$sql = "INSERT INTO hospede (first name, last name, email, phone, contributor, cc, address, incoming date, outgoing date, num_days)
VALUES ('$first name', '$last name', '$email', '$phone', '$contributor', '$cc', '$address', '$new date', '$data_exit', '$num_days')";
$result = mysqli_query($con, $sql);
if ($result)
echo "";
Else
echo "Error trying to record data in the database!";
?>
Come back
Someone can edit, I don’t know how to format.
Please provide a snippet of code in the question instead of an image.
– reisdev
https://pt.meta.stackoverflow.com/questions/5483/manual-de-como-n%C3%83o-fazer-perguntas/5485#5485
– user60252
That’s it, I’m waiting for someone to format my text.
– Ivo Miguel