CloudBreaker Posted September 1, 2015 Share Posted September 1, 2015 Had this working fine for weeks, then I come back and I get a warning. There's a chance I could have "fat-fingered" something in the code...but I've gone through line by line and haven't found anything. Maybe I'm looking to hard... Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in B:\Programs\wamp\www\hsa\rfi_list.php on line 29 thanks, CB <?php $conn = mysqli_connect("localhost","root","","hsa_project_hub"); session_start(); if(!$_SESSION['user_loginName']){ header("location: index.php"); } else { ?> <?php //assign project ID value to local variable $project_id=$_SESSION['project_id']; $sql = "SELECT rfis.no,rfis.name,rfis.subject,rfis.issued_by,rfis.date_submit,rfis.needed_by,rfis.answered_by,rfis.date_returned,rfis.status\n" . "FROM projects,rfis\n" . "WHERE projects.project_id=rfis.id\n" . "AND project_id=$project_id"; $result=mysqli_query($conn,$sql); $row=mysqli_fetch_assoc($result); $run = mysqli_query($conn, $sql); $i=0; ?> <!DOCTYPE HTML> <html> <head> <title>RFI List</title> <link href="hsastyle.css" rel="stylesheet"> </head> <body> <div id="main_container"> <p><em>version 1.0 beta</em></p> <div id="banner"> <div id="logo"> <img src="images/hsa-logo.jpg" alt=HSA logo> </div> <div id="logout"><H5><a href="logout.php">Log Out</a></H5></div> <div id="welcome"><h6>Welcome <?php echo $_SESSION['firstName'];?></h6></div> <div id="project_name"> <strong><em><?php echo $_SESSION['projName']?></em></strong> </div> </div> <!--End Banner--> <div id="create"> <FORM> <INPUT Type="BUTTON" Value="Create New RFI" Onclick="window.location.href='new_rfi.php'"> </FORM> </div> <div id="user_list"> <FORM> <INPUT Type="BUTTON" Value="Back to Projects" Onclick="window.location.href='main.php'"> </FORM> </div> <div class="CSSTableGenerator" > <table align="center"> <tr align="center"> <th>RFI No.</th> <th>Subject</th> <th>Issued by:</th> <th>Date Submitted</th> <th>Needed by:</th> <th>Answered by:</th> <th>Date Returned</th> <th>Status</th> </tr> <?php //assign values to local variables while($row=mysqli_fetch_array($run)){ $rfi_id =$row["no"]; $rfiName =$row["name"]; $subject =$row["subject"]; $issued_by =$row["issued_by"]; $date_submit =$row["date_submit"]; $needed_by =$row["needed_by"]; $answered_by =$row["answered_by"]; $date_returned =$row["date_returned"]; $status =$row["status"]; $i++; ?> <tr align="center"> <td><a href="edit_rfi.php?id=<?php echo $rfi_id;?>"><?php echo $rfiName;?></a></td> <td><?php echo $subject;?></td> <td><?php echo $issued_by;?></td> <td><?php echo $date_submit;?></td> <td><?php echo $needed_by;?></td> <td><?php echo $answered_by;?></td> <td><?php echo $date_returned;?></td> <td><?php echo $status;?></td> </tr> <?php } ?> </table> </div><!-- end of table style </div> <!--End main container--> <!--<p id="copy_right">Heitkamp Swift Architects © 2015</p>--> </body> </html> <?php } ?> Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted September 1, 2015 Solution Share Posted September 1, 2015 (edited) That means your query failed (the boolean is false). What does mysqli_error say? How can you be sure that $project_id has a value? Edited September 1, 2015 by requinix Quote Link to comment Share on other sites More sharing options...
Barand Posted September 1, 2015 Share Posted September 1, 2015 Why two calls to the same query? $result=mysqli_query($conn,$sql); $row=mysqli_fetch_assoc($result); $run = mysqli_query($conn, $sql); 1 Quote Link to comment Share on other sites More sharing options...
CloudBreaker Posted September 1, 2015 Author Share Posted September 1, 2015 That means your query failed (the boolean is false). What does mysqli_error say? How can you be sure that $project_id has a value? I incidentally imported an older database...thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.