NETTİM
← Kod Sonuçlarına Dön
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.
HelloWorld.php • PHP
<?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

Benzer Kod Örnekleri

PHP — HelloWorldTest.php
PHP • SQL sorguları
PHP: Constants - Manual
PHP • SQL sorguları
PHP — edit.php
PHP • SQL sorguları
PHP — delete.php
PHP • SQL sorguları