php - SQL query doesn't get values -
the sql query returns array in browser if there values in database. have tried query in phpmyadmin , works not in php document.
require_once('connect.php'); $query = "select `id` `questions` round='1' , year='2016'"; $sql = mysqli_query($dbconnect, $query); $row = mysqli_fetch_array($sql, mysqli_assoc);
almost same query works in different php documents. suggestions wrong? should query should return integers.
$query = "select `id` `questions` round='1' , year='2016'";
you're selecting id
column. if wish echo more columns, need add them in query.
i.e.:
$query = "select `id`, `col2`, `col3` `questions` round=1 , year=2016";
then loop on results:
while ($row = mysqli_fetch_array($sql, mysqli_assoc)) { echo $row['id']; // echo "<br>"; // echo $row['col2'] . "<br>"; // echo $row['col3']; }
check errors on query , assuming successful mysqli_
connection.
other reference:
Comments
Post a Comment