Skip to content

Instantly share code, notes, and snippets.

@marcmartino
Created August 27, 2012 23:31
Show Gist options
  • Save marcmartino/3493363 to your computer and use it in GitHub Desktop.
Save marcmartino/3493363 to your computer and use it in GitHub Desktop.
mysqli issue
public function getCurrentAttempt($mysqli){
include_once('global/objects/objectQuizAttempt.php');
//error_log("QUIZ INSTANCE ID: " . $this->getID());
$stmt = $mysqli->prepare("SELECT `ID` FROM `Quiz Attempts` WHERE `Quiz Instance ID` = ? ORDER BY `ID` DESC LIMIT 1");
$stmt->bind_param('s',$this->getID());
$stmt->execute();
$stmt->bind_result($attemptID);
$stmt->fetch();
$stmt->close();
error_log("QUIZ INSTANCE ID " . $this->getID() . " ATTEMPT ID: " . $attemptID);
return new objectQuizAttempt($attemptID);
}
//error logs "QUIZ INSTANCE ID 129 ATTEMPT ID: 0"
//when i run the sql in the db with instance id of 129 i get `ID` 110
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment