开发者

Really appreciate what is wrong with this SQL query statement

I just cannot figure out What is wrong with this query?

$q_u= "SELECT 开发者_如何学JAVA* FROM myTable where dd='$xx'";
                $u = mysql_query($q_u, $conf) or die(mysql_error());
                $row_u= mysql_fetch_assoc($u);
                $dn = $row_u['d'];

The problem is the results are not being displayed when the values is passed into $xx.

Thanks Jean


General debugging hints:

  • Output the query: echo $q_u; to see whether it makes sense (i.e. if $xx is okay, and doesn't get garbled somewhere)

  • Count the results using mysql_num_rows() - mysql_error() will catch only real errors, not empty results!

  • If there are results, dump them using var_dump($row_u) to see what columns you get

if, as it turned out here, no results are returned, no data in your database matches your condition. You'll need to look into the database to find out why.


Turn on the mysql general query log and look at what actually arrives in the database.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜