0

my php code is given below....

i run this file getting above error... why getting this error. please help me...

Getting error in this code...please help... i have changed it also like..

<html>

<head>

  <title>MySQLi Read Records</title>

</head>

<body>

  <?php $mysqli=n ew mysqli( 'localhost', 'root', '', 'employe'); //Output any connection error if ($mysqli->connect_error) { die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error); }else{ echo"connection good"; } //query all records from the database $sql = "SELECT id,employe_name,gender,jdate FROM employe_detail"; $result=$mysqli->query($sql);
  echo "
  <div><a href='add.php'>Create New Record</a>
  </div>"; if($result->num_rows>0){ //get number of rows returned echo"
  <table border='2'>"; echo"
    <tr>"; echo"
      <th>ID</th>"; echo"
      <th>Employe Name</th>"; echo"
      <th>Employe Gender</th>"; echo"
      <th>Employe Joining Date</th>"; echo"
    </tr>"; while($row = $result->fetch_assoc()){ echo"
    <tr>"; echo "
      <td>" .$row['id']."</td>"; echo "
      <td>".$row['employe_name']."</td>"; echo "
      <td>" .$row['gender']."</td>"; echo "
      <td>" .$row['jdate']."</td>"; echo "
      <td>" <a href="edit.php?id={'.$row[" id "].'} ">Edit</a>"</td>"; echo"

    </tr>"; } } else{ //if database table is empty echo "No records found."; } //disconnect from database $mysqli->close(); ?>

</body>

</html>
Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
  • `n ew mysqli` should be `new mysqli`, also `` it should be echo and wrapped in double quotes or you need to close php tags before .. and manage accordingly .. also follow/consider syntax highlighting
    – kamal pal Jul 31 '15 at 16:22
  • 1
    The code really needs some proper indenting and lines. You'll have a heckuva time troubleshooting if it doesn't get straightened up. – Jay Blanchard Jul 31 '15 at 16:29

0 Answers0