0

我正在使用 PHP 和 MySQL 数据库。

    $con=mysql_connect("localhost","XYZ","pqr") or die("Failed to connect with database!!!!");
    mysql_select_db("LMN", $con); 

    //Code and SQL query to find out the User transactions count of all types from beginning till today's date
    $sql  =" SELECT COUNT(*) `carried out`, SUM(transaction_status = 'success') `success`, ";
    $sql .=" SUM(transaction_status = 'inprocess') `inprocess`, SUM(transaction_status = 'fail') `fail`, ";
    $sql .=" SUM(transaction_status = 'cancelled') `cancelled` FROM OCN.user_transaction ";



    $result = mysql_query($con,$sql);
echo $result; die;  

    $r =  mysql_fetch_array($result);

如果我要去echo $result然后出现空白屏幕。我不明白这段代码有什么问题?任何人都可以帮助我识别错误吗?

4

1 回答 1

0
$result = mysql_query($sql) or die(mysql_error());
$r = mysql_fetch_array($result, MYSQL_ASSOC);
print_r($r);
于 2013-07-15T21:24:13.400 回答