[SOLVED] HELP! PHP Parse Error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zatch
Forum Newbie
Posts: 18
Joined: Fri Jul 02, 2004 7:05 pm

[SOLVED] HELP! PHP Parse Error

Post by zatch »

I was editing some code and i can't figure out why i get this error

"Parse error: parse error, unexpected $ in /clients/billing/invoice.php on line 116"

Code: Select all

<?
session_start();
if(!session_is_registered("client_id"))
{
header("Location: index.htm");
exit;
}

include "inc/dbconnect.php"; 
$result = mysql_query("SELECT * FROM invoices WHERE id = '$id'",$db);
include ("inc/date.php");
while ($row = mysql_fetch_array($result)) 
{
	$invoiceid = $row["id"];
	$clientid = $row["clientid"];
	$date = $row["date"];
	$dateshow = fixdate($date);
	$details = $row["details"];
	$total = $row["total"];
	$STATUS = $row["STATUS"];
}

?>
<html>
<head>
<title>Invoice <? echo "$client_ref / $invoiceid"; ?></title>
<link rel="stylesheet" href="inc/style.css" type="text/css">
</head>
<? 
if ($clientid !== $client_id) {
echo "This invoice is not accessible by your user profile. Please <a href=menu.php>return to the main menu</a>";
}
elseif ($clientid == $client_id) {
	?>
<body bgcolor="#FFFFFF" text="#000000">
<center>
	<img src="http://zachlevin.us/images/ZachNetLogo.jpg" width="440" height="52">
  <table width="550" border="0" cellspacing="0" cellpadding="0">
    <tr valign="top">
      <td>
        <h2 align="center">INVOICE</h2>
        <h1 align="center"><b><? echo $yourtitle ?></b></h1>
        <p align="right"><? echo $address ?></p>
        <table width="550" border="1" cellspacing="0" cellpadding="2" bordercolor="#CCCCCC">
          <tr valign="top">
            <td width="100">Client</td>
            <td width="450">
              <div align="right"><? echo $client_title ?></div>
            </td>
          </tr>
          <tr valign="top">
            <td width="100">Reference</td>
            <td width="450">
              <div align="right"><? echo "<b>$client_ref / $invoiceid</b>"; ?></div>
            </td>
          </tr>
          <tr valign="top">
            <td width="100">Date</td>
            <td width="450">
              <div align="right"><? echo $dateshow ?></div>
            </td>
          </tr>
          <tr valign="top">
            <td width="100" height="300">Description</td>
            <td width="450" height="300">
              <p><? echo $details ?></p>
              <p>&nbsp;</p>
            </td>
          </tr>
          <tr valign="top">
            <td width="100">Total</td>
            <td width="450">
              <div align="right"><? echo $total ?></div>
            </td>
          </tr>
	  <tr valign="top">
	    <td width="100">Bill Status</td>
	    <td width="450">
	      <div align="right">
	<?
	      		if ($STATUS=="paid")
		{
		echo "Payment Received. Thank You!";
		}
else
		{
		echo "Payment not yet received. Please mail payment to address printed 			on this page";
		} 
		
	?>

	</td></tr></div><br>
        </table>
 <p align="center"><? echo $payee ?><br>
          <? echo  $due ?></p>
      </td>
    </tr>
    <tr valign="top">
      <td>

<SCRIPT LANGUAGE="JavaScript">
if (window.print) {
document.write('<form><input type=button name=print value="Print invoice" onClick="javascript:window.print()"></form>');
}
</script>
      </td>
    </tr>
  </table>
<?
{
?>
  
</center>
</body>
</html>

feyd | use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

<?
{
?>
Shouldn't that be a closing } ??
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what's line 116.. I'm not counting all that.
zatch
Forum Newbie
Posts: 18
Joined: Fri Jul 02, 2004 7:05 pm

Post by zatch »

Thats insignifcant - and was always there - the error occurs when i delete that code too and the line # doesnt change :(
zatch
Forum Newbie
Posts: 18
Joined: Fri Jul 02, 2004 7:05 pm

Post by zatch »

I would imagine that line 116 is around here:

Code: Select all

<? 
               if ($STATUS=="paid") 
      { 
      echo "Payment Received. Thank You!"; 
      } 
else 
      { 
      echo "Payment not yet received. Please mail payment to address printed          on this page"; 
      } 
       
   ?> 

   </td></tr></div><br> 
        </table> 
<p align="center"><? echo $payee ?><br> 
          <? echo  $due ?></p> 
      </td> 
    </tr> 
    <tr valign="top"> 
      <td> 
?>
Does the fact that the info comes from MySQL change the way you have to set up the If...then statements?
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Thats insignifcant
Making sure your {'s and }'s match up is significant imho.
zatch
Forum Newbie
Posts: 18
Joined: Fri Jul 02, 2004 7:05 pm

Post by zatch »

deleted that code and still got an error
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Why are you deleting it? It shows { when it should be a } to match up with the elseif way above it.
zatch
Forum Newbie
Posts: 18
Joined: Fri Jul 02, 2004 7:05 pm

Post by zatch »

SOLVED!

Im stupid - and u were right about the

Code: Select all

<?php
{ being }

?>

thing.


Thanks SOOOOOOO MUCH!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$payee nor $due are set inside the posted code, where do they come from?
Post Reply