Hi guys, I just started PHP and found a script for AJAX suggest. Unfortunately it doesn't work and I think the problem is in this script. What i want to get a list of 'gemeenten' (places) that look like the .php?city= in the URL.
echo out[0] gives no results, but if i put the sql into my phpmyadmin, it works just fine. Do I need to convert my $_GET['city'] or is it something else?
<?php
include("database.php");
//query
if(!empty($_GET['city'])){
$sql = 'SELECT gemeentenaam FROM gemeenten WHERE gemeentenaam LIKE ("'. $_GET['city'] .'%")';
$out = mysql_query($sql);
echo "Does this work? " .$out[0];
$i = 1;
while($city = mysql_fetch_assoc($out)){
if($i > 1){ echo '/';}
echo $city['city'];
$i++;
}
}
?>