Skip to content

Instantly share code, notes, and snippets.

@dennisahlqvist
Created November 17, 2013 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dennisahlqvist/7518235 to your computer and use it in GitHub Desktop.
Save dennisahlqvist/7518235 to your computer and use it in GitHub Desktop.
$query->bind_param
if($stmt = $this->db->prepare("INSERT INTO messages (name,mail,message) VALUES (?,?,?)")){
$stmt->bind_param("sss",$this->name,$this->mail,$this->message);
$stmt->execute();
$stmt->free_result();
$stmt->close();
}
###########################################################
$sql=("SELECT
tbl_user.user_id,
tbl_user.user_firstname,
tbl_user.user_lastname,
tbl_user.user_email,
tbl_user.user_phonenumber
FROM
tbl_user
WHERE
tbl_user.user_archived = 0 OR
tbl_user.user_archived IS NULL;
");
if($stmt = $mysqli->prepare($sql)){
$stmt->execute();
$stmt->bind_result($id,$firstname,$lastname,$email,$phone);
while($data = $stmt->fetch()){
}
$stmt->free_result();
$stmt->close();
}else{
echo $mysqli->error;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment