PHP PDO Class PDOx

Namık Kemal
IRONSIDE
Messages
1,099
Reaction score
2,855
Points
1,133
Awards
8
Warez Puanı
1,397
₩Coin
11,002,987
Username Style
Profile Music ( MP3 Çalsın )
LV
11
 
Connect:

PHP:
require 'vendor/autoload.php';

$config = [
    'host'        => 'localhost',
    'driver'    => 'mysql',
    'database'    => 'test',
    'username'    => 'root',
    'password'    => '',
    'charset'    => 'utf8',
    'collation'    => 'utf8_general_ci',
    'prefix'     => ''
];

$db = new \Buki\Pdox($config);

$records = $db->table('users')
        ->select('id, name, surname, age')
        ->where('age', '>', 18)
        ->orderBy('id', 'desc')
        ->limit(20)
        ->getAll();

var_dump($records);

İNSERT:
PHP:
$data = [
    'name' => 'Burak',
    'surname' => 'Demirtaş',
    'age' => '24',
    'country' => 'Turkey',
    'city' => 'Ankara',
    'status' => 1
];

$query = $db->table('users')->insert($data);

if($query)
{
    echo 'Record added! <br />' .
         'InsertID: ' . $db->insertId();
}
DELETE:
PHP:
$query = $db->table('pages')->where('year', 2014)->where('status', 0)->delete();

if($query)
{
    echo 'Record(s) deleted!';
}


UPDATE:

PHP:
$data = [
    'username' => 'new-user-name',
    'password' => md5('new-password'),
    'status' => 1
];

$query = $db->table('users')->where('id', 17)->update($data);

if($query)
{
    echo 'Record updated!';
}

SELECT:
PHP:
$records = $db->table('users')
        ->select('name, surname, age')
        ->where('age', '>', 18)
        ->orderBy('id', 'desc')
        ->limit(20)
        ->getAll();

foreach($records as $record)
{
    echo $record->name . '<br />' .
         $record->surname . '<br />' .
         $record->age;
}




İNDİR
 
Friend
Prime
New
Messages
28
Reaction score
1
Points
8
Awards
1
Warez Puanı
129
₩Coin
0
LV
1
 
Eline sağlık. Yararlı Paylaşım
 
Friend
Prime
New
Messages
41
Reaction score
0
Points
8
Awards
1
Warez Puanı
62
₩Coin
0
LV
1
 
ellerine sağlık teşekkürler
 
M.K.A
Sülük
Messages
132
Reaction score
62
Points
48
Awards
3
Warez Puanı
396
₩Coin
0
LV
5
 
eline sağlık yararlı paylaşım
 
Guest
New
Messages
3
Reaction score
0
Points
1
Awards
1
Warez Puanı
56
₩Coin
0
LV
1
 
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock