1
Greetings gentlemen,
I’m trying to design a portal where my clients can view their invoices, statements and bills. As you can see it’s all very amateur, but it’s almost ready to do what I need. Below follows the PHP code and how I did so that the "invoice" information of the database could turn a link (for viewing and downloading a file). The problem arises when I try to do the same with the object "reserve".
As there will always be multiple bookings per invoice, Mysql extracts this information as a line. I need to manipulate every number present in it, but everything I try just affects my line as a whole.
Here is a link to a previous question explaining the use of group_concat in this case: https://stackoverflow.com/questions/38549723/how-to-group-data-with-mysql-php
Page result:
<?php
$mysqli = NEW MySQLi('localhost','root','','server');
$sqlFatura = $mysqli->query("SELECT login as NOME,fatura AS
Fatura, Emissao, Vcto, group_concat(reserva) AS RESERVAS
FROM usuarios INNER JOIN faturas,anexos WHERE
usuarios.ID=IDlogin AND faturas.ID=IDfatura AND login='".
mysql_real_escape_string($_SESSION['login'])."' GROUP BY fatura");
if($sqlFatura->num_rows > 0){
while($rows = $sqlFatura->fetch_assoc()){
$fatura = $rows['Fatura'];
$loc = $fatura .".pdf";
$stur = $rows['RESERVAS'];
$emissao = $rows['Emissao'];
$vcto = $rows['Vcto'];
echo "<p> Fatura $fatura Emitida dia $emissao Vencimento
$vcto=><a href='$loc' target='_blank'>DOWNLOAD</a> ANEXO: $stur<br></p>";
}
}else{
echo "SEM FATURAS.";
}
?>
Thank you in advance for the help and for any clarifications just contact.
Att,
You want to return reservations is want to have, which index as references ? The invoice id?
– MagicHat
Yes, exactly.
– Bruno Santos
This image you posted, is the return of the post function ?
– MagicHat
Yes, and the result so far. Note that I managed to make each invoice in a link to the file. Now I need to do the same for each of the numbers that follow the attachment (407685,408475,etc...).
– Bruno Santos
Good, but apparently, the information is coming correctly from the bank, what you want now is to make each of the reservations a clickable link that points to an address, that’s it ?
– MagicHat
Yeah, I guess you just treat php. Unfortunately I’m not able to do, I’ve been trying to break my head with a loop, while and for, but I can’t get any results without repeats and still not clickable.
– Bruno Santos