Jump to content

parse error?


ckdoublenecks

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.