<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "basa";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$cap_question = $_GET["cap_question"];
$cap_server = $_GET["cap_server"];
$cap_answer = $_GET["cap_answer"];
$sql1;
if($cap_answer && $cap_question && $cap_answer){
$sql1 = "INSERT INTO drp_captch (server, question, answer)
VALUES ('$cap_server', '$cap_question', '$cap_answer')";
}
$sql = "SELECT server, question, answer FROM drp_captch WHERE server = 'Amber', question = 'Один плюс четыре', answer = '5' ";
$result = $conn->query($sql);
if ($result->num_rows > 0)
{
printf ("%s %s %s\n", $row["server"], $row["question"], $row["answer"]);
$result->free();
}
if (mysqli_query($conn, $sql1)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql1 . "<br>" . mysqli_error($conn);
}
$conn->close();
?>