Can anyone please explain why I am getting no result from my below script:
When I run the query in phpmyadmin it returns the correct result (the id
), but running my below php script it echo´s out "No row found!";
<?php
if(isset($_SESSION['word'])) {
$word = $_SESSION['word']."<br>";
echo $word;
$query = ("SELECT id FROM customer WHERE mobil = $word");
if (!$query) {
die('Invalid query: ' . mysql_error());
}
else {
$results = mysql_query($query);
while ($row = mysql_fetch_assoc($results)) {
echo '<pre>', print_r($row), '<pre>';
}
if (!$row) {
echo "No row found!";
}
}
}
?>