We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25551 ☆ A M B ☆
    • 1,231 Posts
    I’m creating a very simple ticket system for one of my sites and I’m a little stuck. Basically I have most of it completed but I’m stuck on the permissions part.

    I want to display tickets submitted by a user only to that user and I want to display any admin replies as well.

    $dbQuery = "SELECT * FROM $mytable WHERE ticketID='$ticketID' AND internalKey='$userID'  ";
    $result = mysql_query($dbQuery) or die( mysql_error() );
    while ($row = mysql_fetch_array($result)) {
    extract($row);
    
    $ticketnameAlt = $row['ticketname'];
    
    if ($_SESSION['webInternalKey'] == $userID){
    echo $ticketname;
    	}
    }
    


    This is simplified from what I have but you can see that the results will show tickets from a userID which is taken from the SESSION. That works fine but how do I include any replies from an admin’s userID as well? I searched for info on multiple WHERE clauses but that didn’t give me any helpful info on what I’m trying to achieve.
      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
      AugmentBLU - MODX Partner

      BLUcart - MODX Revolution E-Commerce & Shopping Cart
      • 3749
      • 24,544 Posts
      See if this helps, it has a very similar query in the example:


      http://wiki.modxcms.com/index.php/API:DBAPI:select
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting