Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php pdo get id selected by href

<?php
include "/includes/db.php";
$id = $_GET['id'];
$options = [
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,        // enable PDO errors
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,   // fetch associative arrays by default
    PDO::ATTR_EMULATE_PREPARES => false,                // Use native prepared statements
];
//                      You should always specify charset VVVVV
$pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $username, $password, $options);

// Prepare and execute SQL passing in the value of $id  // Verificar o pedido "GET" id param
  $id = $_GET['id'];
  
  // Preparar e executar a passagem SQL no valor de $id
  $query = $pdo->prepare('SELECT * FROM nametable WHERE id = ? ORDER BY nameselect DESC');
  $query->execute([$id]);
?>
  <html>
   <?php foreach($query as $row ?>
     $row  ['namerow']
     <?php } ?>
  </html>
Comment

PREVIOUS NEXT
Code Example
Php :: get 2 hrs before data in php 
Php :: wordpress get the short permalink 
Php :: check array has keys in php 
Php :: laravel list all tbales 
Php :: php simple sse 
Php :: convert_uuencode (PHP 5, PHP 7, PHP 8) convert_uuencode — Uuencode a string 
Php :: assocititive multi array compare php 
Php :: send data with href 
Php :: recursive directory only listing php 
Php :: heroku deploy php 
Php :: reindex after post api magento 2 
Php :: how to redirect in php use variable from another file 
Php :: laravel blade excerpt from body 
Php :: find auth laravel 
Php :: Full text search laravel mongodb 
Php :: php check if stdclass object has property 
Php :: how does substr_compare() works PHP 
Php :: bulk write mongodb php 
Php :: Add current year on WordPress using Shortcode 
Php :: square root 
Php :: how get some parameter from request in laravel 
Php :: laravel index method 
Php :: how to get today week month ad year data in eloquent 
Php :: s how to store jwt in http cookie laravel 
Php :: Update Data Multiple Columns MySql Database Table PHP Function 
Php :: codeigniter check view file exists 
Php :: php 30days 
Php :: laravel check if query builder is empty 
Php :: laravel 8 php version requirements 
Php :: php date with out 0 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =