Advertisement
Guest User

Untitled

a guest
Jan 9th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. <?php
  2.   $servername = "localhost";
  3.   $username = "root";
  4.   $pass = "pass";
  5.   $dbName = "SheetPal";
  6.   $conn = mysqli_connect($servername , $username , $pass , $dbName);
  7.  
  8.   if(!$conn){
  9.     die("Connection failed: " . mysqli_connect_error());
  10.   }
  11.   else{
  12.     if( !$getWeek = $conn->prepare("SELECT date,task,paycode,starttime,finishtime,breaks,totalhours,comments FROM shifts") ){
  13.       echo "Getweek prepare failed: (" . $conn->error . ")";
  14.     }
  15.     else{
  16.       $getWeek->execute();
  17.       if( !$getWeek->bind_result($date, $task, $paycode, $starttime, $finishtime, $breaks, $totalhours, $comments) ){
  18.         echo "Getweek bind results failed: (" . $getWeek->errno . ") " . $getWeek->error;
  19.       }
  20.       else{
  21.         $shift = array();
  22.         while($getWeek->fetch()) {
  23.           $shiftObject = (object) [
  24.           "date" => $date,
  25.           "task" => $task,
  26.           "paycode" => $paycode,
  27.         ];
  28.         }
  29.       }
  30.     }
  31.   }
  32.  
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement