Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Fetch Data From Database With PDO

$host = 'localhost'; // URL to the server
$username = 'root'; // Username (xampp = root)
$password = ''; // Password (xampp = )
$dbname = 'apifile';
$pdo = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
$sql = "SELECT * FROM `prop` WHERE propkey='localhost_100100'";

$q = $pdo->query($sql);

$q->setFetchMode(PDO::FETCH_ASSOC);
$r = $q->fetch();
var_dump($r['propvalue']);
Comment

php pdo fetch from db

$pdo = new PDO('mysql:host=$host; dbname=$database;', $user, $pass);
$stmt = $pdo->prepare('SELECT * FROM auction WHERE name = :name');
$stmt->bindParam(':name', $_GET['searchdivebay']);
$stmt->execute(array(':name' => $name);
Comment

PREVIOUS NEXT
Code Example
Php :: woocommerce show data to cart page 
Php :: session laravel 
Php :: send html email laravel 
Php :: laravel session add 
Php :: create livewire component 
Php :: laravel date format 
Php :: echo ternary php 
Php :: laravel log build 
Php :: how to read data from serial port in php 
Php :: php array has key 
Php :: laravel make auth 
Php :: the_post_thumbnail 
Php :: php destroy session after some time 
Php :: cannot use font awesome in php mvc 
Php :: how to get product id by sku in woocommerce 
Php :: keep only n elements of array php 
Php :: date to string php 
Php :: laravel button redirect 
Php :: php now 
Php :: laravel eloquent mass update 
Php :: get user type wp php 
Php :: laravel create new request 
Php :: full month name php 
Php :: create if not exist laravel 
Php :: array_key_exists 
Php :: take 10 skip 10 laravel 
Php :: laravel delete relationship data 
Php :: date time laravel 
Php :: php time to date 
Php :: contains php 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =