Jump to content

having trouble understanding error


ckdoublenecks

Recommended Posts

I get this error

 

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in C:\xampp\htdocs\hofiles\receipts2.php on line 24

 

with this code ?

 

<?php
$apt=$_POST['apt'];
$name=$_POST['name'];
$amtpaid=$_POST['amtpaid'];
$datepaid=$_POST['datepaid'];
$stat = mysql_connect(localhost,root,"") or die('Unable to connect to database: ' . mysql_error()); 
$stat = mysql_select_db(prerentdb) or die('Unable to select database: ' . mysql_error()); 
if(!empty($_POST["submit"]))
{
$apt = $_POST['apt'];
$query="SELECT * FROM payments Where apt='$apt'";

$result=mysql_query($query);
if(mysql_num_rows($result))
?>
<html><body>
<font size=2><b>Hammock Oaks Apartments</font>
   Rent Receipt<p>
<?php
{
  echo "<form action='#' method='post'>
        while($row = mysql_fetch_assoc($result))
  {
      echo "$name in apartment $apt has paid $amtpaid on this day $datepaid<br />";
}
         else{echo "No listing for apartment $apt.<br />Please select another.";
}
$stat = mysql_query($query) or die('Query failed: ' . mysql_error()); 
mysql_close();

?>
<form method="post" action="#">
<br />
<input type="text" name="apt"/> <p>
<input type="submit" name="submit" value="receipt apartment"/>
</form>
</b></body></html>

Link to comment
https://forums.phpfreaks.com/topic/213750-having-trouble-understanding-error/
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.