WHY WONT YOU WORK!!!???!!!???
Posted: Thu Aug 01, 2002 8:16 pm
yes, im still a n00b. plz help me fix this. ts purpose is to list users in the database and let admins delete members.
error:
Parse error: parse error, unexpected '}' in c:\program files\apache group\apache\htdocs\test.php on line 29
error:
Parse error: parse error, unexpected '}' in c:\program files\apache group\apache\htdocs\test.php on line 29
Code: Select all
<?php
if (empty($_GETї'action']))
{
$_GETї'action'] = 0;
}
$action = $_GETї'action'];
if (empty($_GETї'ID']))
{
$_GETї'ID'] = 0;
}
$ID = $_GETї'ID'];
switch($action)
{
case "default":
$conn = mysql_connect("localhost", "", "");
mysql_select_db("guestbook", $conn);
$query = "SELECT * FROM users";
$result = mysql_query($query,$conn)or die("query failed");
?>
<table border="3">
<tr>
<th>User#</th>
<th>Username</th>
<th>Password</th>
<th>Admin Status</th>
<th>Admin Function</th>
</tr>
<?php
while($r=mysql_fetch_array($result))
{
$id = $rї"ID"];
$un = $rї"username"];
$pass = $rї"password"];
$admin = $rї'admin'];
echo "<tr><td>$id</td><td>$un</td><td>$pass</td><td>$admin</td>
<td><a href="?action=delete&ID=" . $ID . "">Delete user</a></td>
</tr>";
}
break;
case "delete":
$conn = mysql_connect("localhost","", "") or die ("cant connect");
$query = "delete from users where ID = '$ID'";
mysql_select_db("guestbook",$conn) or die ("cant change");
$result=mysql_query($query ,$conn) or die ("cant do it");
break;
?>