Re: Need your help again.. Sorry...

From: Date: Sun, 21 Jul 2002 05:28:16 +0000
Subject: Re: Need your help again.. Sorry...
Groups: php.general 
Request: Send a blank email to php-general+get-108704@lists.php.net to get a copy of this message
>Can you please tell me why this code fputs($write, "$productlist"); isn't >printing correctly? What *IS* it printing? Blank lines? Nothing? Something? >I have already connected to db. Just this particular one didn't work... dun >understand.. > > >The Code: > > > fputs($write, "Email: $email\n\nProduct Enquired:"); > > while (list($key,$prod_id) = each($cart)) { > > $cart[$key] = $prod_id; > > $result = mysql_query("SELECT * FROM products WHERE prod_id = >'$prod_id' ORDER BY prod_brand ASC", $link_id); # Check Apache error_log for errors: if (!$result){ error_log(mysql_error()); } > $query_data = mysql_fetch_array($result); > > $gst = 1.10; > > $rrp = 1.12; > > $price = $query_data["price_lq"] * $rrp * $gst; > > $productlist .= "\n\n".$query_data["prod_brand"]." >".$query_data["prod_desc"]." $".number_format($price, 2, '.', >''); At a minimum, you can't have that " $" in there and expect it to work... " \$" will do what you want. > > fputs($write, "$productlist"); The quotes are kinda silly here. You're forcing PHP to create another string with the string $productlist in it, but it's already a string, and you're not adding anything new to it. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#108704) next »