NameSilo

Parse error: parse error, unexpected $

Spacemail by SpaceshipSpacemail by Spaceship
Watch

efriese

Established Member
Impact
0
Getting this error: "Parse error: parse error, unexpected $ on line 41". I've looked at this code, but I know I'm missing something. Thanks in advance!

PHP:
<? 
printLog("++++++ Constructing invoice records");
$now = date("YmdHis",$TIME);
$now2 = date("Ymd",$TIME);
$dbquery = "SELECT * FROM PHP_AUCTION_auctions
			WHERE ends <='$NOW'
			AND ((closed='0')
			OR (closed='1')
				AND reserve_price > 0
				AND num_bids > 0
				AND current_bid < reserve_price
				AND sold='s'))";

$get_auctions = mysql_query($dbquery);

$auc_num = mysql_num_rows($get_auctions);

if ($auc_num > 0) {
	while($a = mysql_fetch_array($get_auctions)){
	extract($a);

	$auction_ID = $ID;
	$fee = $current_bid*0.08;
	$fee_rounded = round($fee,2);

	$record = mysql_query("INSERT INTO PHPAUCTION_invoices VALUES ('NULL','$auction_ID','$user','$fee_rounded','$NOW')");
	//log results
	printLog("++++++ Invoicing Successful!");
}
?>
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
Its pretty aparent that that is not the full code ;)

Post it all...

If you really want to help give me a url... to the file with the error
and copy that file and make it a .phps so i can see the source.
 
0
•••
Full code doesn't matter. He is missing an instance of the closing brackets: }

Stick another } at the end, or where you want the while loop to close.
 
0
•••
As KodeKing mentiond so your code should be:

if ($auc_num > 0) {
while($a = mysql_fetch_array($get_auctions)){
extract($a);

$auction_ID = $ID;
$fee = $current_bid*0.08;
$fee_rounded = round($fee,2);

$record = mysql_query("INSERT INTO PHPAUCTION_invoices VALUES ('NULL','$auction_ID','$user','$fee_rounded','$NOW ')");
//log results
printLog("++++++ Invoicing Successful!");
}
}
?>
 
0
•••
That did the trick. Thanks!
 
0
•••

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back