I dont understand why this not work: 😕
<?php if(isset($_GET['slettgb']) || isset($_GET['id'])) { if(!$_SESSION['admins']) echo "not acces"; else { $id = $_GET['id']; $sql17 = "DELETE FROM gjestebok where id = '$id'"; $sql18 = mysql_query($sql17); if($sql18){ echo "Deleted!"; echo "$sql17"; } } } ?>
<a href="?side=gjestebok&slettgb&id=<?php echo $q; ?>">Delete</a>
$q = id.
What is wrong ?
Parse Error :: Syntax error :: Unexpected "}" on line 14.
You've got too many "}" or not enough "{". Walk through you're logic, you're missing an "{" somewhere, or you added a "}" at the end.
bpat1434 wrote:Parse Error :: Syntax error :: Unexpected "}" on line 14.
Where did you get that from ?:queasy:
Nevermind, I saw the wrong thing....
Have you tried echoing [man]mysql_error/man if you're not getting a result?
Also, what "doesn't work"? Is it the query, the if() construct, what?
I don't understand the question...
Try this:
<?php if(isset($_GET['slettgb']) || isset($_GET['id'])) { if(!$_SESSION['admins']) { echo "not acces"; } else { $id = $_GET['id']; $sql17 = "DELETE FROM gjestebok where id = '$id'"; $sql18 = mysql_query($sql17) or die(mysql_error()); if($sql18){ echo "Deleted!"; echo "$sql17"; } } } ?>
medusa1414: What do you mean "it doesn't work"? Is there an error message that accompanies the page in question? Does it constantly do something else you're not expecting it to?
Did adding the "or die(mysql_error())" like Brajan suggested lead you to anything?