Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST["idalunos"])) {
- $idalunos = $_POST["idalunos"];
- $erro = 1;
- require_once("../../../../Connections/connections.php");
- // Create a new DB connection
- $link = new_db_connection();
- /* create a prepared statement */
- $stmt = mysqli_stmt_init($link);
- $link2 = new_db_connection();
- /* create a prepared statement */
- $stmt2 = mysqli_stmt_init($link2);
- $query2 = "DELETE FROM encarregadoeducacao
- WHERE idencarregadoEducacao = ?
- ";
- $query = "SELECT pai_idpai, mae_idmae, autenticacao_idautenticacao, encarregadoEducacao_idencarregadoEducacao FROM alunos WHERE idalunos = ?";
- if (mysqli_stmt_prepare($stmt, $query)) {
- mysqli_stmt_bind_param($stmt, 'i', $idalunos);
- /* execute the prepared statement */
- mysqli_stmt_execute($stmt);
- /* bind result variables */
- mysqli_stmt_bind_result($stmt, $pai, $mae, $aut, $enc);
- /* fetch values */
- while (mysqli_stmt_fetch($stmt)) {
- if (mysqli_stmt_prepare($stmt2, $query2)) {
- mysqli_stmt_bind_param($stmt2, 'i',$enc );
- /* execute the prepared statement */
- if (!mysqli_stmt_execute($stmt2)) {
- $erro = 2;
- //header("Location: index.php?msgDelete= $erro#mensagem");
- } else {
- echo "aquii3i";
- $link3 = new_db_connection();
- /* create a prepared statement */
- $stmt3 = mysqli_stmt_init($link3);
- $query3 = "DELETE FROM pai
- WHERE idpai = ?
- ";
- if (mysqli_stmt_prepare($stmt3, $query3)) {
- mysqli_stmt_bind_param($stmt3, 'i',$pai );
- /* execute the prepared statement */
- if (!mysqli_stmt_execute($stmt3)) {
- $erro = 2;
- //header("Location: index.php?msgDelete= $erro#mensagem");
- } else {
- $link4 = new_db_connection();
- /* create a prepared statement */
- $stmt4 = mysqli_stmt_init($link4);
- $query4 = "DELETE FROM mae
- WHERE idmae = ?
- ";
- if (mysqli_stmt_prepare($stmt4, $query4)) {
- mysqli_stmt_bind_param($stmt4, 'i',$mae );
- /* execute the prepared statement */
- if (!mysqli_stmt_execute($stmt4)) {
- $erro = 2;
- //header("Location: index.php?msgDelete= $erro#mensagem");
- } else {
- $link5 = new_db_connection();
- /* create a prepared statement */
- $stmt5 = mysqli_stmt_init($link5);
- $query5 = "DELETE FROM autenticacao
- WHERE idautenticacao = ?
- ";
- if (mysqli_stmt_prepare($stmt5, $query5)) {
- mysqli_stmt_bind_param($stmt5, 'i',$aut );
- /* execute the prepared statement */
- if (!mysqli_stmt_execute($stmt5)) {
- $erro = 2;
- //header("Location: index.php?msgDelete= $erro#mensagem");
- } else {
- }
- /* close statement */
- mysqli_stmt_close($stmt5);
- } else {
- echo "Error: " . mysqli_error($link5);
- }
- /* close connection */
- mysqli_close($link5);
- // header("Location: index.php?msgDelete= $erro#mensagem");
- }
- /* close statement */
- mysqli_stmt_close($stmt4);
- } else {
- echo "Error: " . mysqli_error($link4);
- }
- /* close connection */
- mysqli_close($link4);
- // header("Location: index.php?msgDelete= $erro#mensagem");
- }
- /* close statement */
- mysqli_stmt_close($stmt3);
- } else {
- echo "Error: " . mysqli_error($link3);
- }
- /* close connection */
- mysqli_close($link3);
- // header("Location: index.php?msgDelete= $erro#mensagem");
- }
- /* close statement */
- mysqli_stmt_close($stmt2);
- } else {
- echo "Error: " . mysqli_error($link2);
- }
- /* close connection */
- mysqli_close($link2);
- // header("Location: index.php?msgDelete= $erro#mensagem");
- }
- }else{
- }
- mysqli_stmt_close($stmt);
- }else{
- }
- mysqli_close($link);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement