[SOLVED] Unexpected $ that won't go away

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
knight666
Forum Newbie
Posts: 5
Joined: Fri Mar 11, 2005 9:40 am
Location: Kerkdriel, the Netherlands

[SOLVED] Unexpected $ that won't go away

Post by knight666 »

I am making a webpage so that you can select a company and then select an employee from the database.
That part worked fine.
Next, I wanted to check if the company even HAD members and if not, don't show them.
I stumbled upon some troubles, but it seemed to be going alright.
But then, I had an unexpected $.
Now, I've searched the board, and it appears that it happens when you don't close your code right.
So I checked my code, saw that it in fact didn't have such a close tag and added it.

The error stayed.
Now, I've tried placing the close bracket somewhere else, remove the echo I had just added and even commented the if.
The error STAYS.

This is my code now:

Code: Select all

<html>
<head>
 <title>Testsite</title>
</head>
<body>
<form method="post" action="tabel.php">
<?php include("connect.php");
$Database=mysql_query("SELECT * from Lid_Hdr");

?>
<table border=0>
 <tr>
 <th width=250 align="left">Lidbedrijf:</th>
 <th width=250 align="left">
  <select name="LidBedrijf" OnChange="submit();">
   <?php 
    while($rij=mysql_fetch_array($Database))
    {
    echo "<option value=\"";
    echo $rij["LidHdrNr"]."\"";
    if($LidBedrijf==$rij["LidHdrNr"]){echo "selected";}
    echo ">";
    echo $rij["LidRoepNaam"]."</option>\n";
    }
   ?>
  </select>
 </th>
 <tr>
 <th width=250 align="left">Medewerker:</th>
 <th width=250 align="left">
   <select name="MedeWerker" OnChange="submit();">
    <?php 
     if ($LidBedrijf)
     {
     $Database2=mysql_query("SELECT * from Mw_Hdr where LidHdrNr = '$LidBedrijf';");
     while($Rij2=mysql_fetch_array($Database2))
      {
      echo "<option value=\"";
      echo $Rij2["MwHdrNr"]."\"";
      if($MedeWerker==$Rij2["MwHdrNr"]){echo "selected";}
      echo ">";
      echo $Rij2["MwRoepnaam"]."</option>\n";
      }
     }
    ?>
   </select>
 </th>
 <th width=250 align="left"><input type="submit" name="KnopNieuw" value="Nieuw"></th>
</table>
<hr align="left" width=600>
<?php 
 $Database3=mysql_query("SELECT * from Mw_Hdr where MwHdrNr=$MedeWerker");
 $Rij3=mysql_fetch_array('$Database3);
 if ($LidBedrijf and !$MedeWerker[$Rij2])
  {
?>
<table border=0>
 <tr>
  <th align=left width=150>Voornaam</th>
  <th align=left>
   <?php
    echo "<input type=\"text\" name=\"TxtVoornaam\"";
    echo "value=".$Rij3["MwVoornaam"].">";
   ?>
  </th>
 </tr>

 <tr>
  <th align=left width=150>Tussenvoegsel</th>
  <th align=left>
   <?php
    echo "<input type=\"text\" name=\"TxtTussenvoegsel\"";
    echo "value=".$Rij3["MwTussenvoegsel"].">";
   ?>
  </th>
 </tr>

 <tr>
  <th align=left width=150>Achternaam</th>
  <th align=left>
   <?php
    echo "<input type=\"text\" name=\"TxtAchternaam\"";
    echo "value=".$Rij3["MwAchternaam"].">";
   ?>
  </th>
 </tr>

 <tr>
  <th align=left width=150>Voorletters</th>
  <th align=left>
   <?php
    echo "<input type=\"text\" name=\"TxtVoorletters\"";
    echo "value=".$Rij3["MwVoorletters"].">";
   ?>
  </th>
 </tr>

 <tr>
  <th align=left width=150>Geslacht</th>
  <th align=left>
   <?php
    echo "<input type=\"text\" name=\"TxtGeslacht\"";
    echo "value=".$Rij3["MwGeslacht"].">";
   ?>
  </th>
 </tr>
</table>
 <?php } ?>
<br>
<input type="submit" name="knop" value="Klik op mij!">
</form>
</body>
</html>
Please help. :cry:
Last edited by knight666 on Fri Mar 11, 2005 4:01 pm, edited 1 time in total.
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

what to do..

Post by neophyte »

I don't see anything wrong with it. Sometimes when I have this problem I comment out code or remove stuff till I find the problem. Start at the very top and comment a "logical" chunk something you're sure will work on it's own and then and another and a another till you find the section with the problem.

Just a tip...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

line 53 looks a bit suspicious..
knight666
Forum Newbie
Posts: 5
Joined: Fri Mar 11, 2005 9:40 am
Location: Kerkdriel, the Netherlands

Post by knight666 »

It does actually...

It was the problem all along.
Thank god I have a color coded syntax compiler now... :roll:
Post Reply