Don't like ads? PRO users don't see any ads ;-)
Guest

get-news.php

By: FamiHug on May 27th, 2012  |  syntax: PHP  |  size: 0.49 KB  |  hits: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. require_once 'config.php';
  4. startMySQLConnection();
  5.  
  6. $sql = "SELECT n.id AS id,n.name AS name,n.summary AS summary,p.image AS image,n.creationDate AS creationDate
  7. FROM news n
  8. INNER JOIN leagues l ON n.leagueId=l.id
  9. INNER JOIN photos p ON n.leagueId=p.leagueId
  10. WHERE n.leagueId=" . $_REQUEST['leagueId'];
  11.  
  12. $query = mysql_query($sql);
  13. while ($row = mysql_fetch_array($query)) {
  14.         $row["image"] = prefixFullUrl($row, "image");
  15.     $output[] = $row;
  16. }
  17.  
  18. print json_encode($output);
  19. ?>