Курсовая работа: Создание инструментального средства для организации социологических опросов
$id = htmlspecialchars($_REQUEST['ank_del']);
$query ="DELETE FROM `quest` WHERE `idank` = '$id'";
mysql_query($query);
$query ="DELETE FROM `ank` WHERE `idank` = '$id'";
mysql_query($query);
die("<p><a href='index.php'>Анкета удалена</a>");
}
if(isset($_REQUEST['save_new']))
{
if(!isset($_REQUEST['name']) || !isset($_REQUEST['newquest']))
die("<p><a href='index.php'>Ошибка</a>");
$newq = $_REQUEST['newquest']['text'];
$query = "SELECT COUNT(*) FROM ank WHERE `title` ='".$newq ."'";
$name = $_REQUEST['name'];
$type = $_REQUEST['newquest']['type'];
$result = @mysql_query($query);
if(mysql_result($result,0)>0)
return;
$query = "INSERT INTO `ank` ( `idank` , `title` , `votes` )
VALUES (
'', '$name', '0'
)";
$result = @mysql_query($query);
$query = "SELECT idank FROM ank WHERE `title` = '$name'";
$result = @mysql_query($query);
$idank = @mysql_result($result,0);
$query = "INSERT INTO `quest` ( `id` , `idank` , `text`,`type`) VALUES (
'', '$idank', '$newq','$type')";
$result = @mysql_query($query);