project.php 463 B

123456789101112131415
  1. <?php
  2. require_once(realpath(dirname(__FILE__)).'/config.php');
  3. require_once(PATH_PHP.'database.php');
  4. global $mysqli;
  5. function projectObj($id){
  6. if($res = query("SELECT p.title,p.id,p.description,u.name as user FROM `projects` p JOIN `users` u ON u.id = p.u_id WHERE p.id='%d'",Array($id))){
  7. if($res->num_rows == 1){
  8. $project = $res->fetch_assoc();
  9. $project['user'] = userObj($project['user']);
  10. return $project;
  11. }
  12. }
  13. return false;
  14. }
  15. ?>