• User Attivo

    eliminare due record sul database

    salve sto tentando di eliminare due record sul database ma non riesco a farlo funzionare sicuramente sbaglierò qualcosa 😞

    <ul id="chatList"
        		    class="list-group mvh-50 overflow-auto">
        			<?php if (!empty($conversations)) { ?>
        			    <?php 
    
        			    foreach ($conversations as $conversation){ ?>
    	    			<li class="list-group-item">
    					<p>Elimina chat</p>
    					<form action="delchat.php" method="post" enctype="multipart/form-data">
    					<input name="chat_id"/>
    					<input type="hidden" value="<?= $_SESSION['name'] ?>">  
    					<input type="submit" name="del" value="Elimina chat">
    					</form>
    	    				<a href="chat.php?user=<?=$conversation['username']?>"
    	    				   class="d-flex
    	    				          justify-content-between
    	    				          align-items-center p-2">
    	    					<div class="d-flex
    	    					            align-items-center">
    	    					    <img src="uploads/<?=$conversation['p_p']?>"
    	    					         class="w-10 rounded-circle">		  
    	    					    <h3 class="fs-xs m-2">
    								    <?=$conversation['username']?><br>
    	    					    	<?=$conversation['name']?><br>
                          <small>
                            <?php 
                              echo lastChat($_SESSION['user_id'], $conversation['user_id'], $conn);
                            ?>
                          </small>
    ------------------------------------------
    file delchat.php
    
    <?php
    	include('app/db.conn.php');
    	
    	if (isset($_POST['del'])){
    		$chat_id=$_POST['chat_id'];
    		
    		
    		mysqli_query($conn,"delete from `chats` where chat_id='$chat_id'");
    		mysqli_query($conn,"delete from `conversations` where conversation_id='$conversation_id'");
    		header("Location: home.php");
    	}
    ?>
    
    
    
    
    
    

    massimux 1 Risposta
  • Moderatore

    @imperor quale errore ti restituisce?