Jump to content
Larry Ullman's Book Forums

Katie

Members
  • Posts

    1
  • Joined

  • Last visited

Katie's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I'm trying to run a query of existing employee records in order to update their information, and am receiving the error: Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/schill54/public_html/Capstone/htdocs/Home/updateform.php on line 8 Below is my script. I've tweaked the query several times with no luck. Originally I had it set to SELECT * from my users table but then realized there was 1 column that I didn't want it to return and therefore I didn't account for it in my form, so then listed the desired columns individually but still getting the error. From the google searching I've done so far I realize there is probably still something wrong with my query but can't figure out what it is. <?php { include ("../includes/header.php"); require_once ('../../mysqli_connect.php'); $lname=$_GET['last_name']; $query = "SELECT first_name, last_name, phone, username, pass, admin FROM users WHERE last_name='$lname'"; $result = mysqli_query ($dbc, $query); $num = mysqli_num_rows($result); if ($num > 0) { // If it ran OK, display all the records. while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){ ?> <form action="updatemp.php" method="post"> <p>First Name: <input name="text" size=30 value="<? echo $row['first_name']; ?>"></p> <p>Last Name: <input name="text" size=30 value="<? echo $row['last_name']; ?>"></p> <p>Phone Number: <input name="text" size=30 value="<? echo $row['phone']; ?>"></p> <p>User Name: <input name="text" size=30 value="<? echo $row['username']; ?>"></p> <p>Password: <input name="text" size=30 value="<? echo $row['pass']; ?>"></p> <p>Admin Access?: <input name="text" size=30 value="<? echo $row['admin']; ?>"></p> </form> <? } //end while statement } //end if statement mysqli_close($dbc); //include the footer include ("../includes/footer.php"); } ?>
×
×
  • Create New...