Plz Help i Dont know what is wrong in this function ....
$gsql = "SELECT * FROM posts WHERE group='$group_name' ORDER BY postdate DESC LIMIT 0,20";
$gquery = mysqli_query($db_conx, $gsql);
$gstatusnumrows = mysqli_num_rows($gquery);
while ($grow = mysqli_fetch_array($gquery, MYSQLI_ASSOC)) {
and it keeps saying this error :-
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in D:\group.php on line 3
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\group.php on line 5
That means your query failed.
[
mysqli_query
] returnsFALSE
on failure. For successfulSELECT
,SHOW
,DESCRIBE
orEXPLAIN
queriesmysqli_query()
will return amysqli_result
object. For other successful queriesmysqli_query()
will returnTRUE
.
So use mysqli_error
to find out what you did wrong. In this case, though, it's because you have a column named "group". GROUP
is a reserved word in MySQL. To be on the safe side, ALL database, table and column names SHOULD be enclosed in backticks `
to prevent any possible ambiguity.