Code mailbox

hi guy

. I need help in this my mailbox code below
. I want to use this user id

…customerid
…adminid
…employeeid

.to view the information in the database table when one among them session start or login in same page
.what query and condition I can be use?

<?php
session_start();
include("header.php");
include("dbconnection.php");

if(isset($_GET["mailid"]))
{
	mysqli_query($con,"DELETE FROM mail where mailid='$_GET[mailid]'");
	$recres = "Mail deleted Successfully...";
}

$result = mysqli_query($con,"SELECT * FROM mail where reciverid='$_SESSION[ ]'");
?>
    
     <div id="templatemo_main">
  <div align="center"><span class="main_top"></span> 
    
  </div>
  <div align="center"></div>
  <div id="templatemo_content">
     		 <h2 align="center">INBOX</h2>
            <?php
            global $recres;
             echo $recres; ?>
         <table width="600" border="1">
    
             
              <?php
		 echo " <tr>";
                echo " <th scope='col' width='45' >Delete</th>";
                echo " <th scope='col'>SENDER</th>";
                echo " <th scope='col'>SUBJECT</th>";
                echo " <th scope='col'>TIME</th>";
                echo " </tr>";
         		while($row = mysqli_fetch_array($result))
  				{
    			echo " <tr>";
                echo " <th scope='col'><a href='mailinbox.php?mailid=$row[mailid]'>Delete</a></th>";
                echo " <th scope='col'>$row[senderid]</th>";
                echo " <th scope='col'>$row[subject]</th>";
                echo " <th scope='col'>$row[mdatetime]</th>";
                echo " </tr>";
  				}
?>           
      </table>
       	  </form>
        <?php

?>

If you’re saying that when the user logins in they will be one of three different types of user, and the id needed to retrieve mail will be one of those three, then I would modify the login code so that when it retrieves the user having checked passwords etc., it also copies the id into a variable that always has the same name. So when it gets to the code above, you don’t need to care what type of user has logged in. Or you could use isset() to determine which variable has a value, and use that for the query.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.