Hello i have a problem ..
I made a little "shop" system for representative. They can make orders, this orders be saved on the database with the id of each user.
Then they can view there orders.
Now i would create a search field with autocomplete where they can filter the orders by customer name .
But the problem is that i can´t hand over the session id of the user or a variable. This way the result: each name in the database get displayed.
The PHP is working (it display only the correct names) just the autocomplete doesn´t work.
$(document).ready(function() {
$('#vertverkauf').autocomplete({
minLength: 1,
source: function(request, response){
$.ajax({
url:"/php_fs/ajax-search-ver.php",
dataType:"json",
html: true,
data:{term:request.term},
success: function(data){
response(data.slice(0,10));
}
});
},
});
});
$search = $_GET['term'];
$idver = $_SESSION['id'];
$result = $conn->query("SELECT DISTINCT `kunde` FROM `verkauf` WHERE
`vertreterid` = '%$idver%' AND kunde LIKE '%$search%' ORDER BY `kunde` DESC");
$daten = array();
while ($row=$result->fetch_assoc()){
$daten[] = $row['kunde'];
}
echo json_encode($daten);