-3
Guys I have a table that lists records in the database and in front of each record has a button like this
<a href="index.php?mod=pedidos&funcao=editar&id=<?=$lnped['protocolo']?>" class="ls-btn-primary ls-ico-user"></a>
$lnped['protocolo']
comes from the database is the registration number
and I need that by clicking this button it changes the field "PRODUCED" of the selected record to '1' only that when I click it changes all that are in the table and not only what I clicked
here is my code
<?php
$idget = isset($_GET['id']) ? $_GET['id'] : '';
$produzir = isset($_GET['funcao']) ? $_GET['funcao'] : '';
$consultapedidos = mysql_query("SELECT * FROM pedidos WHERE protocolo = '".$idget."'");
if(mysql_num_rows($consultapedidos)==true){
if($produzir == "editar"){
$sql = mysql_query("UPDATE pedidos SET produzido = '1'") ;
echo "<meta http-equiv='refresh' content='1;' URL= index.php?mod=pedidos>";
}
}
?>
Use stacksnippets only for codes that can be reproduced, if you don’t know how to format the question, click the question mark button that appears when you are editing or writing a question and you will see the hints, I’m sure it will take my comment as a constructive criticism.
– Guilherme Nascimento
It’s in PHP, if I put snippets n will show the right code.
– Alfredo Lima
This is not only the question of showing something, it is the question of whether something runs or not, I recommend you to read: http://meta.pt.stackoverflow.com/questions/js-css-e-html-executables-no-corpo-da-question-ou-resposta and http://meta.pt.stackoverflow.com/questions/1084/how-towe must-format-questions-and-answers and http://meta.pt.stackoverflow.com/questions/2363/howto make our use-do-snippet-more intuitive. . I’m sure you’ll take my tips as constructive and understand that I’m just guiding you :)
– Guilherme Nascimento
On the table requests there is also the field protocol ?
– Edilson
But the protocol field only exists in the requested table.
– Alfredo Lima