-2
I just need to get the R.A’s of the SELECT
and play at UPDATE
, but every time I put $usuario['ra]
, of a mistake:
Parse error: syntax error, Unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or Identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C: xampp htdocs myschool test.php on line 36
<?php
require_once('db_class.php');
$sql = "SELECT * FROM usuario WHERE ativo_sn = 'n' ";
$objdb = new db();
$link = $objdb->conecta_mysql();
$result = mysqli_query($link,$sql);
?>
if($result){
$dados = array();
while($linha = mysqli_fetch_array($result,MYSQLI_ASSOC)){
$dados[] = $linha;
}
foreach ($dados as $usuario) {
?>
<label><?php echo $usuario['nome_user'];?> </label><br/>
<label><?php echo $usuario['ra'];?> <br/>
<a href="" onclick="<?php mysqli_query($link,
"UPDATE usuario SET ativo_sn = 's' WHERE ra = '**PRECISO COLOCAR R.A AQUI**' ");
?>">Aceitar</a><hr/>
<?php
}
it worked!! but every time I enter the page it already executes the query, even when I put in the onclick of the link, I switched for button and still goes automatically : aa
– Rafael Fracasso