php - get Latest Registered Id? -
code :
want have latest registered employeeid in drop down list database ?
public function getemployeeid() { if (!isset($_session["email"]) || !isset($_session["passwrd"])) { header("location:index.php"); // cannot access page without login. } if (empty($_post)) { $query = mysqli_query($this->connection, "select employeeid employees") or die("query execution failed: " . mysqli_error()); while ($row = $query->fetch_array()) { $id = $row["employeeid"]; $_session["id"] = $id; } } }
here html code snippet :
<td> <select name="employeeid" required autofocus class='form-control'> <option value=""> ----select----</option> <?php if (isset($_session["id"])) { echo "<option value = " . $_session["id"] . ">" . $_session["id"] . "</option>"; } ?> </select> </td>
your query should be:
select max(employeeid) employeeid employees
Comments
Post a Comment