<?php

require_once ("common.php");
// retrieve starting letters from the $GET request
$start = $_GET["input"];

// generate SQL query
$query = "SELECT * FROM users WHERE name LIKE '" . $start . "%' ";

$result = mysql_query($query);


if(mysql_num_rows($result)==0) {
	print("No suggestions");
}


$br = "<br />";
// for each name in the table, return them one in each line.
while ($row = mysql_fetch_array($result)) {
  $text = "Name: ".$row["name"].$br;
  $text = $text."Age: ".$row["age"].$br;
  $text = $text."City: ".$row["city"].$br.$br;
  print($text);
}


?>
