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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.