Problems deleting mysql database

0

Good morning, I'm creating a function to delete in the database, but when I click the button it does not work, I'd like some suggestions.

requests.php

    <?php
   $sqlCat = "SELECT cliente_id,cliente_nome,cliente_email,cliente_telefone,cliente_bairro,cliente_rua,cliente_complemento FROM cliente"; $tbCat = mysql_query($sqlCat) or die(mysql_error()); if(mysql_num_rows($tbCat) > 0){ while($rsCat = mysql_fetch_array($tbCat)){
?>


<tr>
  <td>1asdas</td>
  <td>aaaaaaa </td>
  <td> 3 </td>
  <td>4</td>
  <td>
    <?php echo $rsCat['cliente_nome'];?>
  </td>
  <td>
    <?php echo $rsCat['cliente_email'];?>
  </td>
  <td>
    <?php echo $rsCat['cliente_telefone'];?>
  </td>
  <td>
    <?php echo $rsCat['cliente_bairro'];?>
  </td>
  <td>
    <?php echo $rsCat['cliente_rua'];?>
  </td>
  <td>
    <?php echo $rsCat['cliente_complemento'];?>
  </td>

  <td class="td-actions"><a href="#" class="btn btn-small btn-success"><i class="btn-icon-only icon-edit"> </i></a>
    <a href="href=Pedidos_delete.php?deleta=<?php echo $rscat['cliente_id'];?>" title="Excluir"><img src="img/admin/icons/cross.png" alt="Excluir" /></a>

</tr>
<?php
    }
        }
  else
             {
  echo '<div class="alert alert-danger">
 <button type="button" class="close" data-dismiss="alert">x</button>
 <label><strong>ERRO!</strong> sem cadastro.</label>
 </div>';
  }



  ?>

  </tbody>

  </table>

Requests_delete.php (where I call the file to delete)

<?php
include_once('../scripts/config.php');
include_once('../scripts/funcoes.php');
include_once('seguranca.php');

$sql = "DELETE  FROM cliente WHERE cliente_id={ $_GET['idrecado]}";
$apagar = mysql_query($sql) or die (mysql_error());

echo "<meta HTTP-EQUIV='Refresh' CONTENT='0;URL=pedidos.php'>";
?>
    
asked by anonymous 12.05.2017 / 15:54

1 answer

0

Change the GET to $ _GET ['delete'], so you will be getting the value as it passed.

href="href=Pedidos_delete.php?deleta=<?php echo $rscat['cliente_id'];?>" 

Also, look at the code above, I think it's wrong ...

href="Pedidos_delete.php?deleta=<?php echo $rscat['cliente_id'];?>"

    
12.05.2017 / 16:33