User types someones username into the text box and using AJAX I automatically suggest words (usernames) to the user.
This is the AJAX code where the MySQL query is and which prints it out:
<?php
include_once('connect.php');
$search_text = $_GET['search_text'];
$safe_text = mysql_real_escape_string($search_text);
if(strlen($search_text) > 0) {
$search_user = "SELECT * FROM accounts WHERE Name LIKE '$safe_text%' ORDER BY score DESC LIMIT 10";
$query = mysqli_query($con, $search_user) or die(mysql_error());
while ($row = mysqli_fetch_assoc($query)) {
$name = $row['Name'];
$id = $row['ID'];
$score = $row['Score'];
echo '<div class="well well-sm" style="margin-top:4px; margin-bottom: 0px;"><span class="glyphicon glyphicon-user" aria-hidden="true" style="margin-right: 5px;"></span><a href="/profile.php?id='.$id.'">'.$name.'</a><span class="badge" style="margin-left: 10px;">'.$score.' score</span></div><br>';
}
}
?>
It's all working very well on my localhost. When I type in 'Joe', it gives me 10 lines of names which are like 'Joe' and which are ordered by score (Joe with the highest score on top).
The problem is, when I use it on my webserver, it just gives 10 players with the highest score. It doesent care what you enter, it chooses from ALL the players (not even related to Joe). So what is causing this? They are both using the same database, all files same etc.