This topic HAS been solved.
Posted: Thu Jan 27, 2005 7:00 pm
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їid] != '' AND $_COOKIEїusername] != '' and $_COOKIEїpassword] !='') {
$result = mysql_query("SELECT username FROM teachers WHERE username='$_COOKIEїusername]' AND password='$_COOKIEїpassword]' AND id='$_COOKIEїid]'");
if(mysql_num_rows($result) > 0)
$admin = 1;
}
if($admin == 1) {
IF($_GETїa] == "delete") {
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їfilter_teachers]'";
$result = mysql_query($sql);
$main = "<font size='4'><b>$_POSTї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>";
}ELSEIF($_GETїa] == "verify") {
$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*: 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ї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ї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їfilter_teachers]">
<input type='submit' value='OK, Delete $_POSTїfilter_teachers]' name='submit1' tabindex='3' style='font-weight: bold; border-style: dashed; border-width: 1px; background-color: #999999'></p>
</form>
";
}
ELSEIF($_GETїa] != "logout" OR $_GETїa] != "verify" OR $_GETїa] != "post"){
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*: 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ї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)){
$main .= "<option value='$teacherїusername]'>$teacherїusername]</option>\n";
$main .= "</select>
</td>
</tr>
<tr>
<td align='right' width='50%'> </td>
<td align='left' width='50%'> </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>";
}}
?>