PHP
MariaDB
SQL sorguları
Sınıflar
Fonksiyonlar
Lisans: Belirtilmemis
PHP — HelloWorld.php
PHP MariaDB entegrasyonlu — SQL sorguları, Sınıflar, Fonksiyonlar. Sınıflar: HelloWorld. Fonksiyonlar: __construct, hello, what. SQL sorgusu içerir.
<?php
class HelloWorld
{
/**
* @var PDO
*/
private PDO $pdo;
public function __construct(PDO $pdo)
{
$this->pdo = $pdo;
}
public function hello($what = 'World'): string
{
$sql = "INSERT INTO hello VALUES (" . $this->pdo->quote($what) . ")";
$this->pdo->query($sql);
return "Hello $what";
}
public function what()
{
$sql = "SELECT what FROM hello";
return $this->pdo->query($sql)->fetchColumn();
}
}
Tespit Edilen SQL Sorguları
INSERT INTO hello VALUES (
SELECT what FROM hello