messages.php 437 B

1234567891011121314
  1. <?php
  2. require_once(realpath(dirname(__FILE__)).'/config.php');
  3. require_once(PATH_PHP.'database.php');
  4. function messages($id,$type){
  5. switch($type){
  6. case 'project':
  7. if($res = query("SELECT m.id, u.name, m.message, UNIX_TIMESTAMP(m.timestamp) as timestamp FROM `messages` m JOIN `users` u ON u.id = m.from_id WHERE m.p_id='%d'",Array($id))){
  8. return $res->fetch_all(MYSQLI_ASSOC);
  9. }
  10. break;
  11. }
  12. return Array();
  13. }
  14. ?>