Page 1 of 1

This topic HAS been solved.

Posted: Thu Jan 27, 2005 7:00 pm
by Wldrumstcs
I have posted this several times, but it hasn't been solved yet. Basically, on line 111 (the line saying ' $main .=  "</select>  '), there is a parse error saying that there's an unexpected T_Variable. I posted the entire code so you can help me locate the error. Where is it?

Code: Select all

<?
mysql_connect("localhost","$username","$password") or die ("Unable to connect to MySQL server."); 
$db = mysql_select_db("$database") or die ("Unable to select requested database.");

$admin = 0;
if($_COOKIE&#1111;id] != '' AND $_COOKIE&#1111;username] != '' and $_COOKIE&#1111;password] !='') &#123;
  $result = mysql_query("SELECT username FROM teachers WHERE username='$_COOKIE&#1111;username]' AND password='$_COOKIE&#1111;password]' AND id='$_COOKIE&#1111;id]'");
if(mysql_num_rows($result) > 0)  
$admin = 1;
&#125;

if($admin == 1) &#123;



IF($_GET&#1111;a] == "delete") &#123;

mysql_connect("localhost","$username","$password") or die ("Unable to connect to MySQL server."); 
$db = mysql_select_db("$database") or die ("Unable to select requested database.");
$sql = "DELETE FROM teachers WHERE username='$_POST&#1111;filter_teachers]'";
$result = mysql_query($sql);
$main = "<font size='4'><b>$_POST&#1111;filter_teachers] has been deleted from the database.</b></font><br>You are being redirected...";
echo "<head><meta http-equiv='refresh' content='3;URL=admin.php'></head>";

&#125;ELSEIF($_GET&#1111;a] == "verify") &#123;
$main = " <form method='POST' action='delete.php?a=delete'>
<table border='0' width='100%' cellspacing='0' cellpadding='0' id='table10'>
<tr>
<td align='right' width='100%' colspan='2'>
<p align='center'><b><font size='2'>*NOTE*:&nbsp; Don't abuse this power...</font></b></td>
</tr>
<tr>
<td height='10'>
</td>
</tr>
<tr>
<td align='right' width='50%'>
<p align='right'><b>Your Name:</b></td>
<td align='left' width='50%'>$_COOKIE&#1111;username]</td>
</tr>
<tr>
<td align='right' width='50%'>
<p align='right'><b>Teacher that will be deleted:</b></td>
<td align='left' width='50%'>$_POST&#1111;filter_teachers]</td>
</tr>

</table>
<p>
<a href='javascript:history.go(-1);'>
If you want to change something, click here.</a></p>
<p>
<input type='hidden' name='filter_teachers' value="$_POST&#1111;filter_teachers]"> 

<input type='submit' value='OK, Delete $_POST&#1111;filter_teachers]' name='submit1' tabindex='3' style='font-weight: bold; border-style: dashed; border-width: 1px; background-color: #999999'></p>
</form>


";
&#125;
ELSEIF($_GET&#1111;a] != "logout" OR $_GET&#1111;a] != "verify" OR $_GET&#1111;a] != "post")&#123;

mysql_connect("localhost","$username","$password") or die ("Unable to connect to MySQL server."); 
$db = mysql_select_db("$database") or die ("Unable to select requested database.");

$query="SELECT * FROM teachers ORDER BY id ASC";
$result=mysql_query($query);


$main = "<form method='POST' action='delete.php?a=verify'>
            <table border='0' width='100%' cellspacing='0' cellpadding='0' id='table10'>
          
                <tr>
                    <td align='center' width='100%' colspan='2'>
                    <b><font size='2'>*NOTE*:&nbsp; Don't abuse this power...</font></b></td>
                </tr>
<tr>
<td height='10'>
</td>
</tr>
                <tr>
                    <td align='right' width='50%' valign='top'>
                    <p align='right'><b>Your Name:</b></td>
                    <td align='left' width='50%'>$_COOKIE&#1111;username]<br>
                    <font size='2'>(To login under a different username, </font> 
<a href='http://www.***.com/login.php?a=logout'>
<font size='2'>click here.)</font></a></td>
                </tr>
                <tr>
                    <td align='right' width='50%'><b>Teacher that will be deleted:</b></td>
                    <td width='50%' align='left'>
                      <select name='filter_teachers'>
  <option value='showall'>Choose a Teacher</option>
      <option>----------------------</option>";

while ($teacher = mysql_fetch_array($result))&#123;

$main .= "<option value='$teacher&#1111;username]'>$teacher&#1111;username]</option>\n"; 


 $main .=  "</select>   

  </td>
                    </tr>
                    <tr>
                    <td align='right' width='50%'>&nbsp;</td>
                    <td align='left' width='50%'>&nbsp;</td>
                </tr>
            </table>
            <p>
            <input type='submit' value='Proceed' name='submit' tabindex='3' style='font-weight: bold; border-style: dashed; border-width: 1px; background-color: #999999'></p>
                        
        </form>";
&#125;&#125;



?>

Posted: Thu Jan 27, 2005 7:36 pm
by wyred
You didn't close the opening curly bracket on line 11.
if($admin == 1) {

Posted: Thu Jan 27, 2005 7:44 pm
by Wldrumstcs
Actually, I did, but it's in the other part of the script. This is the entire portion above the <html> tags.

Posted: Thu Jan 27, 2005 7:53 pm
by feyd
out of curiosity, what editor are you using?

Posted: Thu Jan 27, 2005 7:53 pm
by Wldrumstcs
Notepad

Posted: Thu Jan 27, 2005 7:55 pm
by feyd
comment out parts, and see if the location changes.. Rewrite lines, completely if needed.

Posted: Thu Jan 27, 2005 8:01 pm
by Wldrumstcs
That's the damndest thing, I rewrote some lines, and it now works. However, I didn't change anything ??? Weird. Anyways, for some reason, there is a HUGE number of breaks before the *note:please dont abuse this power* line around line 100. Where's the error?

Posted: Thu Jan 27, 2005 8:03 pm
by Wldrumstcs
Also, I don't see any <br> in the outputted HTML or anything that would create a break.

Posted: Thu Jan 27, 2005 8:07 pm
by feyd
it's possible you had some ~blank binary data in there or other things..

not sure how you'd do it other than copy and pasting something that the DDE may have screwed up, although the DDE is usually real good.

I'd suggest switching to a decent editor ;)

Posted: Thu Jan 27, 2005 8:11 pm
by Wldrumstcs
Which editor do you recommend?

Posted: Thu Jan 27, 2005 8:14 pm
by Wldrumstcs
Oh, here's the new HTML that is outputted:

Code: Select all

<form method='POST' action='delete.php?a=verify'>
            <table border='0' width='100%' cellspacing='0' cellpadding='0' id='table10'>
          
                <tr>
                    <td align='center' width='100%' colspan='2'>
                    <b><font size='2'>*NOTE*:&nbsp; Don't abuse this power...</font></b></td>
                </tr>
<tr>
<td height='10'>
</td>
</tr>
                <tr>
                    <td align='right' width='50%' valign='top'>
                    <p align='right'><b>Your Name:</b></td>
                    <td align='left' width='50%'>Greg Gebhardt<br>
                    <font size='2'>(To login under a different username, </font> 
<a href='http://www.***.com/login.php?a=logout'>
<font size='2'>click here.)</font></a></td>
                </tr>
                <tr>
                    <td align='right' width='50%'><b>Teacher that will be deleted:</b></td>
                    <td width='50%' align='left'>
                      <select name='filter_teachers'>
  <option value='showall'>Choose a Teacher</option>
      <option>----------------------</option><option value='Kari Cook'>Kari Cook</option>
<option value='Jenne Dehmlow'>Jenne Dehmlow</option>
<option value='Shirley Diaz'>Shirley Diaz</option>
<option value='Daryl Fitts'>Daryl Fitts</option>
<option value='Greg Gebhardt'>Greg Gebhardt</option>
<option value='Todd Kristensen'>Todd Kristensen</option>
<option value='Dan Korntheuer'>Dan Korntheuer</option>
<option value='James Lambatos'>James Lambatos</option>
<option value='Steve Linhardt'>Steve Linhardt</option>
<option value='Lindsay Moen'>Lindsay Moen</option>
<option value='Laura Morgan'>Laura Morgan</option>
<option value='Johnna Norbut'>Johnna Norbut</option>
<option value='Doug Rushing'>Doug Rushing</option>
<option value='Bill Schreier'>Bill Schreier</option>
<option value='Matt Stellwagen'>Matt Stellwagen</option>
<option value='Dennis Walker'>Dennis Walker</option>
<option value='Chuck Williams'>Chuck Williams</option>
<option value='Shana Willilams'>Shana Willilams</option>
</select>

  </td>
                    </tr>
                    <tr>
                    <td align='right' width='50%'>&nbsp;</td>
                    <td align='left' width='50%'>&nbsp;</td>
                </tr>
            </table>
            <p>
            <input type='submit' value='Proceed' name='submit' tabindex='3' style='font-weight: bold; border-style: dashed; border-width: 1px; background-color: #999999'></p>
                        
        </form>

Posted: Thu Jan 27, 2005 8:18 pm
by feyd
please edit your post if you are the last, unless necessary to make a new one.

recommended editors are talked about throughout the "favourite editor" thread in the General Discussion board.

Posted: Thu Jan 27, 2005 8:24 pm
by Wldrumstcs
Sorry about not editing. I truly appreciate all your help!