Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- id team1 team2 home away tip
- ----------------------------------
- 12 xxx yyy zzz kkk
- 43 xxx yyy zzz kkk
- . . . . .
- . . . . .
- $stmt = $db->prepare("SELECT id FROM tablename");
- $stmt->execute();
- $result=$stmt->fetchColumn();
- echo $result[0];
- $stmt = $db->prepare("SELECT id FROM tablename");
- try{
- $stmt->execute();
- }catch(PDOException $err){
- //some logging function
- }
- //loop through each row
- while($result=$stmt->fetch(PDO::FETCH_ASSOC)){
- //select column by key and use
- echo $result['id'];
- }
- $getUsers = $DBH->prepare("SELECT * FROM tablename ORDER BY id ASC");
- $getUsers->execute();
- $users = $getUsers->fetchAll();
- $stmt = $db->prepare("SELECT id FROM tablename ORDER BY id ASC");
- $stmt->execute();
- $result = $stmt->fetchColumn();
- echo $result;
- $stmt = $db->prepare("SELECT id FROM tablename");
- $stmt->execute();
- $result=$stmt->fetch(PDO::FETCH_NUM);
- echo $result[0];
- <?php
- $stmt =("SELECT id FROM tablename");
- $result=$db->prepare($stmt );
- $result->execute();
- while($row = $result->fetch(PDO::FETCH_ASSOC))
- {
- $id = $row['id'];
- echo $id;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement