SmoothSQL is a lightweight PHP library designed to simplify reusable MySQL database operations using prepared statements.
- Insert
# Here is an example with inserting user register
$db->insert("users", [
"username" => $username,
"email" => $email,
"hashed_password" => $hashedPass
]);- Fetch
# Here is an example of fetching user logins
$data = $db->fetch(
"users",
"*",
"email = ?",
[$email]
);- Delete
# Here is an example of deleting messages
if (isset($_POST["deleteBtn"])) {
$db->delete(
"messages",
"id = ?",
[$_POST["msg_id"]]
);
}- Update
# Here is an example of updating user info
$db->update(
"users",
[
"username" => $newUsername,
"email" => $newEmail
],
"id = ?",
[$userId]
);