PHP AJAX and mySQL not returning data? -


i have following block of php:

$word = mysql_real_escape_string(trim($_get['word']));     $firstletter = substr('$word', 0, 1);      $query = "select * `dictionary` word '%$firstletter'";     $result = mysql_query($query) or die(mysql_error().": ".$query);     $row = mysql_fetch_assoc($result);     // send word ajax request     $i = 0;     $fullload = '';     while ($i < mysql_numrows($result)) {         $fullload = $fullload . '|' . $row['word'];         $i++;     }     echo $fullload; 

now, ajax call:

$.ajax({                 type: "get",                 url: "word-list.php",                 data: "word="+ theword,                 success: function(data){ //data retrieved                     console.log(data);                             }     }); 

now, lets assume missing word variable apple - $word = 'apple';

but when console.log() outputs - zero, nothing, nada, zip, blahblah

>:(

try

 $firstletter = substr($word, 0, 1); 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -