I am pretty new to OOP with PHP.
OK first of all this produces an error:
$mail->addBody(new MailWishListInquiry()->getBody(348));
but this doesn't:
$wishListInquiry = new MailWishListInquiry();
$mail->addBody($wishListInquiry->getBody(348));
I do not understand why?
Also the method getBody() is not returning anything..but no error either..here is a snippet of it:
function getBody($pid)
{
$qry = 'SELECT * FROM cart_product WHERE product_id = '.$pid;
$result = mysql_query($qry);
$row = mysql_fetch_assoc($result);
$item_name = $row['product_name'];
$item_url = 'product.php?pid='.$pid;
$item_image_url = 'product_images/'.$pid.'_sm_'.$row['product_image_sm'];
return
?>
<div style="width:600px; font-family:Arial, Helvetica, sans-serif; color:#333333;">
...
</div>
<?php
}
Does anyone know why?
Thanks!!
Edit: You guys have done a good job explaining that dereferencing doesnt work in PHP. But I still need help figuring out why getBody() is not returning a string. Is it because I am breaking out of the php so I don't have to quote it? Even if I pass nothing it should still return the html string right? Why is it not?
Thanks!