×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Nick Cobos
Added: Mar 16, 2017 8:03 PM
Modified: Mar 17, 2017 4:48 AM
Views: 15
Tags: database php pdo
  1. //$conn = PDO object
  2. //$Q = Query
  3. //$id = parameter
  4.  
  5. $Q = $conn->prepare($Q);
  6. $Q->bindParam(':id', $id);
  7. if($Q->execute())
  8. {
  9.         if($res = $Q->fetch(PDO::FETCH_ASSOC))
  10.         {                          
  11.            do
  12.            {
  13.              //over $res['parameter'];
  14.            }while($Q->fetch(PDO::FETCH_ASSOC));
  15.         }
  16.           else return false;
  17. }
  18. else return false;