MySQL cheat sheet

  1. mysqli_connect()
  2. mysqli_query()
  3. mysqli_error()
  4. mysqli_num_rows()
  5. mysqli_fetch_assoc()
  6. WHERE id LIKE ‘%$search%’ – FUZZY search

How to select the last RECOD in MySQL

SELECT * FROM `table_name` WHERE id=(SELECT MAX(id) FROM `table_name`);

// or this code
SELECT * FROM `table_name` ORDER BY id DESC LIMIT 1;