Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Mysql Abstraction Database Class

Featured Replies

So it's been awhile this i posted something I've built on here but thought someone may find this database class useful or build onto it.  Here is the project on github https://github.com/webdeveloper73/MysqliDB/blob/master/MysqliDB.php

here is a basic example...

Example 

<?php
//Connect to database
$db = new MysqliDB("mysql_host","mysql_username","mysql_password","mysql_database");

//SELECT * FROM `posts` WHERE id > 10 AND id < 55 ORDER BY `id` DESC
$db->select()
  ->from("posts")
  ->whereByArray(array("id >" => 10,"id <" => 55))
  ->order_by("id","DESC")
  ->run();

if($db->num_rows() > 0)
{
 foreach($db->result() as $row):
  echo $row->postContent."<br />";
  endforeach;
}else{
 echo "No posts to show"; 
}

Example 2

<?php
//SELECT * FROM `posts` WHERE id > 5
//Pass false to the last parameter to prevent escaping fields with back ticks
//The run method executes the built query
$db->select()->from("posts")->where("id",5,">",null,false)->run();

Example 3 multiple where conditions

//SELECT * FROM `posts` WHERE `id` = 7 OR `id` = 9 LIMIT 1
$db->select()->from("posts")->where("id",7)->where("id",9,null,"OR")->limit(1)->run();

Example 4 whereIN method

//SELECT * FROM `users` WHERE `id` IN('5','8','1','2')
$db->select()->from("users")->whereIN("id",["5","8","1","2"])->order_by("id","DESC")->run();

This class includes quite a few more methods here is the list...

  • rawQuery()
  • insert()
  • insertID()
  • update()
  • delete()
  • escape()
  • num_rows()
  • select()
  • selectCustom()
  • from()
  • where()
  • whereCustom()
  • whereByArray()
  • whereIN()
  • whereNotIN
  • limit()
  • order_by()
  • result()
  • row()
  • run()
  • getLastQuery()

more functionality will be added at a later date

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.