Jump to content

[SOLVED] php error???


cluce

Recommended Posts

Can someone help me fix my errors?

 

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\www\vhosts\reagan\empInfo.php5 on line 19

 

Notice: Undefined index: update in C:\www\vhosts\reagan\empInfo.php5 on line 134

 

here  is my cod below:

    
<?php

//create query and retrieve record of user logged on 
//create and issue the query
   $SQL = "SELECT username, first_name, last_name, address, city, state, zip, phone, altphone, email, company, DATE_FORMAT(last_login,  '%b %e %Y at %r') aS last_login FROM auth_users WHERE username = '".$_SESSION['identity']."'";
   $result = mysqli_query($mysqli,$SQL);
   $row = mysqli_fetch_array($result);

    echo "<strong>Username:</strong> "."<font color='blue'>".$row['username']."</font>";
  echo "<br />";
    echo "<strong>Full name:</strong> "."<font color='blue'>".$row['first_name'] . " " . $row['last_name']."</font>";
  echo "<br />";
    echo "<strong>Address:</strong> "."<font color='blue'>".$row['address']."</font>";
  echo "<br />";
    echo "<strong>City:</strong> "."<font color='blue'>".$row['city']."</font>";
  echo "<br />";
    echo "<strong>State:</strong> "."<font color='blue'>".$row['state']."</font>";
  echo "<br />";
    echo "<strong>Zip:</strong> "."<font color='blue'>".$row['zip']."</font>";
  echo "<br />";
    echo "<strong>Phone Number:</strong> "."<font color='blue'>".$row['phone']."</font>";
  echo "<br />";
    echo "<strong>Alternate Phone Number:</strong> "."<font color='blue'>".$row['Altphone']."</font>";
  echo "<br />";
    echo "<strong>Email:</strong> "."<font color='blue'>".$row['email']."</font>";
  echo "<br />";
    echo "<strong>Company:</strong> "."<font color='blue'>".$row['company']."</font>";
  echo "<br />";
    echo "<strong>Last successful login:</strong> "."<font color='blue'>".$row['last_login']."</font>";
  echo "<br />";
?>

Link to comment
https://forums.phpfreaks.com/topic/109423-solved-php-error/
Share on other sites

The problem is that your query failed, so it returned FALSE (a boolean).  Where is your script that connects to your database?

 

The second error is a result of the first error, in that since $row failed to be assigned, it's not an array and therefore has no indexes.

Link to comment
https://forums.phpfreaks.com/topic/109423-solved-php-error/#findComment-561272
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.