I i get the following error in a script im using has anyone got any ideas what it could be ty jan x
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/letsswin/public_html/template_status.php on line 47

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/letsswin/public_html/template_status.php on line 47

Heres the code for that section

// GATHER UP ANY STATUS REPLIES
$status_replies = "";
$sql2 = "SELECT s.*, u.avatar
FROM status AS u ON u.username = s.author 
WHERE s.osid='$statusid' 
AND s.type='b' 
ORDER BY postdate ASC";

$query_replies = mysqli_query($db_conx, $sql2);
$replynumrows = mysqli_num_rows($query_replies);
if($replynumrows > 0){
while ($row2 = mysqli_fetch_array($query_replies, MYSQLI_ASSOC)) {
$statusreplyid = $row2["id"];
$replyauthor = $row2["author"];
$replydata = $row2["data"];

Hi,

when the query fails MySQLi will return FALSE, so add mysqli_error() to get some information about it.

I think there is an ambiguous column error, which means the two tables have at least a column with the same name, for example postdate.

i put the mysqli_error() in

$status_replies = "";
$sql2 = "SELECT s.*, u.avatar
FROM status AS u ON u.username = s.author 
WHERE s.osid='$statusid' 
AND s.type='b' 
ORDER BY postdate ASC";

$query_replies = mysqli_query($db_conx, $sql2);
$replynumrows = mysqli_num_rows($query_replies)
if($replynumrows > 0){
while ($row2 = mysqli_fetch_array($query_replies, MYSQLI_ASSOC)) {
$statusreplyid = $row2["id"];
$replyauthor = $row2["author"];
$replydata = $row2["data"];
$mysqli_error();

and im getting Parse error: syntax error, unexpected T_IF in /home/letsswin/public_html/template_status.php on line 54

Problem solved x

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.