Permalink
Browse files

Select bugs and json encode

  • Loading branch information...
samcroft committed Sep 27, 2012
1 parent 509061f commit e83964faf3d71820bf6864db89cfa87414129682
Showing with 23 additions and 0 deletions.
  1. +23 −0 server/bugs.php
View
@@ -0,0 +1,23 @@
<?php
$server = "localhost";
$username = "root";
$password = "";
$database = "bapp";
$con = mysql_connect($server, $username, $password) or die ("Could not connect: " . mysql_error());
mysql_select_db($database, $con);
$sql = "SELECT id, title FROM bugs WHERE open = TRUE ORDER BY priority, date_time_added";
$result = mysql_query($sql) or die ("Query error: " . mysql_error());
$bugs = array();
while($row = mysql_fetch_assoc($result)) {
$bugs[] = $row;
}
echo $_GET['jsoncallback'] . '(' . json_encode($bugs) . ');';
mysql_close($con);
?>

0 comments on commit e83964f

Please sign in to comment.