Parse error: parse error, unexpected $

Namecheap AuctionsNamecheap Auctions
NamecheapNamecheap
SpaceshipSpaceship
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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
Close
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
Close
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
Close
That did the trick. Thanks!
 
0
Close
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back