php - show the mysql Select query results -
i using php , mysql wanted bring results of select statement.
i tried use code implementation
<head> <meta http-equiv = "content-type" content = "text/html" charset = "utf-8"> </head> <?php $conn = mysqli_connect("hostname","user","password","dbname"); // check connection if (mysqli_connect_errno()){ echo "mysql error : " . mysqli_connect_error(); } $result = mysqli_query($conn,"select kind,abs(sum(money)) money account userid = 't@t.t' , date_format(adate,'%y/%c') ='2014/8' , checkio = 'out' group kind;"); echo "<table border='1'> <tr> <th>no</th> <th>kind</th> <th>money</th> </tr>"; $no = 1; while($row = mysqli_fetch_array($result)){ echo "<tr>"; echo "<td>" . $no . "</td>"; echo "<td>" . $row['kind'] . "</td>"; echo "<td>" . $row['money'] . "</td>"; echo "</tr>"; $no++; } echo "</table>"; mysqli_close($conn); ?>
no data not come result. this
no kind money
enter on real mysql select statement
select kind,abs(sum(money)) money account userid = 't@t.t' , date_format(adate,'%y/%c') ='2014/8' , checkio = 'out' group kind;
as result
kind money 1000 b 2000 c 1500
come way ...
why don't have output of code?
need change in way?
no need change thing in code replace $row = mysqli_fetch_array($result)
$row = mysqli_fetch_array($result, mysqli_assoc)
; fine.
Comments
Post a Comment