PHP code example of gamerboytr / phpsql

1. Go to this page and download the library: Download gamerboytr/phpsql library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gamerboytr / phpsql example snippets


// Dosya İle
e

$phpsql = new GamerboyTR\phpSQL();

$phpsql = new GamerboyTR\phpSQL("host", "kullanici_adi", "sifre");
// Veya
$phpsql->set_config("host", "kullanici_adi", "sifre");

$phpsql->set_db("veritabani_adi");

$veri = $phpsql->select("seçici", "tablo");
// Örnek
$veri = $phpsql->select("*", "üyeler");

$veri = $phpsql->query("sorgu");
// Örnek
$veri = $phpsql->query("SELECT * FROM üyeler");

$dize = $phpsql->get_config(); // Bir Array Döndürür

// phpSQL ile
$mysqli = $phpsql->connect();
// phpSQL olmadan
try {
    @$mysqli = new mysqli("host", "kullanici_adi", "şifre", "veritabanı");
    if($mysqli->connect_errno)
        die("<br>Mysqli Bağlanma Hatası : ".$mysqli->connect_error);
} catch (\Throwable $th) {
    die("<br>Mysqli Bağlanma Hatası : $th");
}

$phpsql->create_table("tablo_adi", [
    [
        "name" => "satir_adi",
        "type" => "varchar"
    ]
]);

$phpsql->delete("tablo_adi", "seçici");
// Örnek
$phpsql->delete("kullanicilar", "adi='mehmet'");

print_r($phpsql->get_tables("phpsql")); // Bir Array Döndürür

$phpsql->insert("tablo_adi", [
    "veri_adi" => "veri_degeri"
]);

$phpsql->update("tablo_adi", [
    "veri_adi" => "guncellencek_veri_degeri"
], "Nerede");
// Örnek
$phpsql->update("üyeler", [
    "yetki" => "admin"
], "kullanici_adi='gamerboytr'");

$phpsql->create_db("veritabani_adi");

$phpsql->get_dbs(); // Array Döndürür

$phpsql->drop("tablo_veya_veritabani_adi", "silinecek_tur");
// Örnek Veritabanı Silme
$phpsql->drop("phpsql", "database");
// Örnek Tablo Silme
$phpsql->drop("üyeler", "table");

// Örnek
$phpsql = new GamerboyTR\phpSQL();
$phpsql->restore_config();

$phpsql->save_config([
    // Değerler Buraya
]);

$phpsql->restore_config("klasor");