- 정보공유
[PHP] prepare bind_param 쿼리구분 select *
$query = "select * from 테이블 where index = ? and datestring = ?";
$stmt = $connect_db->prepare($query);
$ix = 30;
$date = '2023-10-10';
$stmt->bind_param('is', $ix, $date);
$stmt->execute();
$meta = $stmt->result_metadata();
while ($field = $meta->fetch_field()) {
$params[] = &$row[$field->name];
}
call_user_func_array(array($stmt, 'bind_result'), $params);
while ($stmt->fetch()) {
foreach ($row as $key => $val) {
$c[$key] = $val;
}
$arr_memo[] = $c;
}
$stmt->close();