Hi all,
In the section of the order confirmation mail: $get_cart_info, when I include this theres is somehow a syntax error, as I keep getting this error after mail has tried to send:
Catchable fatal error: Object of class mysqli_result could not be converted to string in /home/www/ebm-fashion.dk/views/betaling_accepteret.php on line 129 (which is $get_cart_info query).
I am somehow stopping the email there. Isnt it possible to make a query inside this varaible when it is included in mail() function?
Its a pretty lame order confirmation if not even the products are in there, so I hope someone can point out what I am doing wrong!
THIS IS MY CODE:
$order_mail_comfirmation = '<div style="width:80%;">
<p>Tak fordi du handlede hos ebm-fashion.dk.</p>
<small>Der er registreret flg. detaljer vedrørende dit køb:</small><br /><br />
<table>
<tr>
<td><small><b>Transaktions id:</b></small></td>
<td style="padding-left:20px;"><small>'.$_SESSION['transaktions_id'].'</small></td>
</tr>
<tr>
<td><small><b>Ordre id:</b></small></td>
<td style="padding-left:20px;"><small>'.$_SESSION['order_id'].'</small></td>
</tr>
<tr>
<td><small><b>Beløb hævet på kort:</b></small></td>
<td style="padding-left:20px;"><small>'.number_format($samlet_pris,2).'</small></td>
</tr>
<tr>
<td><small><b>Dato og tid:</b></small></td>
<td style="padding-left:20px;"><small>'.$added_time.'</small></td>
</tr>
</table>
<br />
<small>
Følgende vare(r) vil blive <b>afsendt</b> indenfor 1-2 hverdage, såfremt det ikke er en bestillingsvare.
</small><br /><br />
<table>
'.$get_cart_info = mysqli_query($connection, "
SELECT produkt_id, navn, vare_type, model, antal, pris, str
FROM cart_indloest WHERE user_id = '".$user_id."' AND ordre_id = '".$_SESSION['order_id']."'") or die(mysqli_error($connection));
while ($cit = mysqli_fetch_array($get_cart_info)) // $cit = cart items
{
// Hent billed extension fra produkter så billedet af det købte prdukt kan vises på kvitteringen:
$get_img_info = mysqli_query($connection, "SELECT img FROM produkter WHERE id = '".$cit['produkt_id']."'");
while ($img_ext = mysqli_fetch_array($get_img_info))
{
$img = $img_ext['img'];
}
'<tr>
<td style="border:1px solid #666;">
<img src="../backend/produkt_img/backend_img/'.$cit['produkt_id'].'.'.$img.'" width="60" height="90" />
</td>
<td style="padding-left:15px; padding-right:15px; background-color:#EEE; border:1px solid #666;">
<small style="color:#333; font-weight:bold;"><b>• '.$cit['antal'].' par '
.ucfirst($cit['navn']).' '
.ucfirst($cit['vare_type']).' - Model '
.ucfirst($cit['model']).' - Stk. pris: '
.number_format($cit['pris'],2).' DKK. - Størrelse: '
.$cit['str'].'</b></small>
</td>
</tr>';
}
'</table>
<br />
<small>
EBM-Fashion forventer at varerne vil blive <b>leveret</b> indenfor 2-3 hverdage:
</small>
<br /><br />
<hr />
<br />
<small><b>Modtager og adresse er registreret til:</b></small>
<br />
<small> '.ucfirst($_SESSION['fornavn']).' '.ucfirst($_SESSION['efternavn']).' </small>
<br />
<small> '.ucfirst($_SESSION['gade']).' '.$_SESSION['hus_nr'].'<br />'.$_SESSION['post_nr'].' '.$_SESSION['by'].' </small>
<br /><br />
<small><b>Der er afsendt en kvittering til:</b></small><br />
<small> '. $_SESSION['email'].' </small><br /><br />
</div>';
// Send email til kunden her:
$to = $_SESSION['email'];
$subject = 'Ordrebekræftelse fra EBM-fashion';
$message = $order_mail_comfirmation;
$headers = "Content-type: text/html; charset=utf-8rn";
$headers .= '<div style="width:500px; height:40px; padding-top:7px; background-color:#ccc; border:1px solid #666;">
<p style="color:#666; margin-left:100px;">
<b>Ordrebekræftelse</b>
</p></div>';
$headers .= '<hr style="width:80%;" align="left"/>';
mail($to, $subject, $message, $headers);