ckdoublenecks Posted January 21, 2011 Share Posted January 21, 2011 I get an error that I have a parse error on line 10? <?php mysql_connect(localhost,root,""); mysql_select_db(prerentdb) or die( "Unable to select database"); if(!empty($_POST["submit"])) { $apt = $_POST['apt']; $query="SELECT * FROM payments Where apt='$apt'"; $result=mysql_query($query); if(mysql_num_rows($result)) } { $sql = "UPDATE payments SET amtpaid = '0', prevbal = '0', tentpay = '0', datepaid = ' ', late = ' ', paidsum = '0' WHERE paidsum = rentdue OR late = 'L'"; mysql_query($sql) or die("Update query failed."); echo "Records have been updated"; } ?> Link to comment https://forums.phpfreaks.com/topic/225195-parse-error/ Share on other sites More sharing options...
Valakai Posted January 21, 2011 Share Posted January 21, 2011 The brace on line 10 is closing ( } ) and not opening ( { ) which is required after an if() Correct code: mysql_connect(localhost,root,""); mysql_select_db(prerentdb) or die( "Unable to select database"); if(!empty($_POST["submit"])) { $apt = $_POST['apt']; $query="SELECT * FROM payments Where apt='$apt'"; $result=mysql_query($query); if(mysql_num_rows($result)) { $sql = "UPDATE payments SET amtpaid = '0', prevbal = '0', tentpay = '0', datepaid = ' ', late = ' ', paidsum = '0' WHERE paidsum = rentdue OR late = 'L'"; mysql_query($sql) or die("Update query failed."); echo "Records have been updated"; } } Link to comment https://forums.phpfreaks.com/topic/225195-parse-error/#findComment-1163054 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.