I know this will probably be very simple, but I don't find a solution.
I am trying to add a class 'inactivelicence' to an object () when the database row 'glider' in table 'users' and where 'username = $u' equals '1'.
This is the code I have now (I only post the code that matters):
<?php
include_once("php_includes/check_login_status.php");
$u = "";
$glider = "";
if(isset($_GET["u"])){
$u = preg_replace('#[^a-z0-9]#i', '', $_GET['u']);
} else {
header("location: index.html");
exit();
}
$sql = "SELECT * FROM users WHERE username='$u' AND activated='1' LIMIT 1";
$user_query = mysqli_query($db_conx, $sql);
while ($row = mysqli_fetch_array($user_query, MYSQLI_ASSOC)) {
$glider= $row["glider"];
}
if($glider == "1"){
echo "<script>$('#glider').addClass('inactivelicence')</script>";
}
?>
<div class="licences">
<img id="glider" src="img/licences/icon_hc.png" >
</div>
UPDATE:
I now have this code :
echo "<script>$(document).ready(function(){$('#glider').addClass('inactivelicence')});</script>";
But I still get an error on this line.. Error: Parse error: syntax error, unexpected '(', expecting T_VARIABLE or '$' in /home/a3318252/public_html/user.php on line 64