本文整理汇总了PHP中Answer::__SET方法的典型用法代码示例。如果您正苦于以下问题:PHP Answer::__SET方法的具体用法?PHP Answer::__SET怎么用?PHP Answer::__SET使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Answer
的用法示例。
在下文中一共展示了Answer::__SET方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Obtain
public function Obtain($id_answer)
{
try {
$query = $this->pdo->prepare('SELECT * FROM Respuestas WHERE id_answer = ?');
$query->execute(array($id_answer));
$r = $query->fetch(PDO::FETCH_OBJ);
$answer = new Answer();
$answer->__SET('id_answer', $r->id_answer);
$answer->__SET('id_event', $r->id_event);
$answer->__SET('respuesta', $r->respuesta);
$answer->__SET('correct', $r->correct);
return $answer;
} catch (Exception $e) {
die($e->getMessage());
}
}
示例2: date
$image['name'] = date('ymhis') . $_FILES['image']['name'];
$image['directory'] = '../img_bbdd/';
move_uploaded_file($_FILES['image']['tmp_name'], $image['directory'] . $image['name']);
$directory = 'img_bbdd/' . $image['name'];
} else {
$image = 'img_bbdd/helados.jpg';
$directory = "img_bbdd/helados.jpg";
}
}
switch ($_REQUEST['action']) {
case 'update':
/*echo "<script type=\"text/javascript\">
alert('¡El registro se ha actualizado exitosamente! El directorio de la imagen es: $directory');
//history.go(-2);
</script>";*/
$answer->__SET('id_answer', $_REQUEST['id_answer']);
$answer->__SET('id_event', $_REQUEST['id_event']);
$answer->__SET('respuesta', $_REQUEST['respuesta']);
$answer->__SET('correct', $_REQUEST['correct']);
$answerModel->Update($answer);
echo "<script type=\"text/javascript\">\n alert('¡El registro se ha actualizado exitosamente! El directorio de la imagen es: {$directory}');\n history.go(-2);\n </script>";
break;
case 'insert':
//$answer->__SET('id_answer' , $_REQUEST['id_answer']);
$answer->__SET('id_event', $_REQUEST['id_event']);
$answer->__SET('respuesta', $_REQUEST['respuesta']);
$answer->__SET('correct', $_REQUEST['correct']);
$answerModel->Insert($answer);
echo "<script type=\"text/javascript\">\n alert('Se ha añadido correctamente a la base de datos una respuesta');\n history.go(-2);\n </script>";
break;
case 'edit':
示例3: alert
if ($_REQUEST['winner'] == '') {
$_REQUEST['winner'] = 'Sin determinar';
}
if ($_REQUEST['tiposelect'] == 2) {
$contest->__SET('id_event', $_REQUEST['id_event']);
$contest->__SET('id_type', $_REQUEST['tiposelect']);
$contest->__SET('name', $_REQUEST['name']);
$contest->__SET('question', $_REQUEST['question']);
$contest->__SET('initial_date', $_REQUEST['initial_date']);
$contest->__SET('final_date', $_REQUEST['final_date']);
$contest->__SET('winner', $_REQUEST['winner']);
$contest->__SET('active', 1);
$contestModel->Insert($contest);
$lastID = $answerModel->lastID();
//$answer->__SET('id_answer' , $_REQUEST['id_answer']);
$answer->__SET('id_event', $lastID);
$answer->__SET('respuesta', $_REQUEST['first_answer']);
$answer->__SET('correct', $_REQUEST['last_correct']);
$answerModel->InsertA($answer);
echo "<script type=\"text/javascript\">\n alert('Se ha añadido correctamente a la base de datos un nuevo Concurso con sus posibles respuestas');\n history.go(-2);\n </script>";
break;
} else {
$contest->__SET('id_event', $_REQUEST['id_event']);
$contest->__SET('id_type', $_REQUEST['tiposelect']);
$contest->__SET('name', $_REQUEST['name']);
$contest->__SET('question', $_REQUEST['question']);
$contest->__SET('initial_date', $_REQUEST['initial_date']);
$contest->__SET('final_date', $_REQUEST['final_date']);
$contest->__SET('winner', $_REQUEST['winner']);
$contest->__SET('active', 1);
$contestModel->Insert($contest);