Receive data from mySQL via php -
can please explain why getting no result below script: when run query in phpmyadmin returns right result (the id
), running below php script echo´s out "no row found!";
<?php if(isset($_session['word'])) { $word = $_session['word']."<br>"; echo $word; $query = ("select id client 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!"; } } } ?>
your query invalid, should this:
$query = mysql_query("your query");
also, shouldn't utilize mysql_ since deprecated , removed. utilize pdo or mysqli instead. can find more info here:
why shouldn't utilize mysql_* functions in php?
php mysql
No comments:
Post a Comment