php - Add class to img if database value equals 1 -


this question has answer here:

i know simple, don't find solution.

i trying add class 'inactivelicence' object () when database row 'glider' in table 'users' , 'username = $u' equals '1'.

this code have (i post code 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 * users username='$u' , 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 have code :

echo "<script>$(document).ready(function(){$('#glider').addclass('inactivelicence')})‌​;</script>";  

but still error on line.. error: parse error: syntax error, unexpected '(', expecting t_variable or '$' in /home/a3318252/public_html/user.php on line 64

if($glider == "1"){     echo "<script>$(document).ready(function(){$('#glider').addclass('inactivelicence')});</script>";  } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -