Хотите получить все фото и видео на стене - делайте три запроса: к wall, wall_photos и wall_audios отдельно
$file = file($_FILES['name']['tmp_file'], FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$query = "INSERT INTO `table` (`name`, `home`) VALUES (?, ?)";
$stmt = $connection->prepare($query);
$stmt->bind_param("ss", $name, $home);
$connection->begin_transaction();
foreach($file as $home) {
$stmt->execute();
}
$connection->commit();
header('Content-Type: text/html; charset=utf-8');
class base{
public $conn;
public function __construct(){
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$this->conn = mysqli_connect('localhost', 'drops', '', 'teach');
mysqli_set_charset($mysqli, $charset);
}
public function query($query, $params = []) {
if (!$params) {
return $this->conn->query($query);
}
$types = $types ?: str_repeat("s", count($params));
$stmt = $this->conn->prepare($sql);
$stmt->bind_param($types, ...$params);
$stmt->execute();
return $stmt;
}
public function get_row($query, $params = []) {
$stmt = $this->query($query, $params);
return $stmt->get_result()->fetch_assoc(MYSQLI_ASSOC);
}
public function get_all($query, $params = []) {
$stmt = $this->query($query, $params);
return $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
}
}
<div class=\"col-md-4 col-sm-6 my-3 my-md-0\">
<form action=\"index.php\" method=\"post\">
<div class=\"card shadow\">
<a href='./index.php?product=$productid'>
<div class="col-md-4 col-sm-6 my-3 my-md-0">
<form action="index.php" method="post">
<div class="card shadow">
<a href="./index.php?product=<?=$productid?>">
<div id="card-top">
$stmt = $db->prepare("INSERT INTO `users` VALUES(null, ?,?)");
$stmt->bid_param("ss", $login, $pass);
$stmt->execute();
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link = mysqli_connect("localhost", "*******", "*******");
$mysqli->set_charset("utf8mb4");
$sql = 'INSERT INTO players SET age = 11';
$result = mysqli_query($link, $sql);
echo "Данные успешно добавлены";
$conditions = [];
$parameters = [];
// conditional statements
if (!empty($_GET['name']))
{
// here we are using LIKE with wildcard search
// use it ONLY if really need it
$conditions[] = 'name LIKE ?';
$parameters[] = '%'.$_GET['name']."%";
}
if (!empty($_GET['age']))
{
// here we are using equality
$conditions[] = 'age = ?';
$parameters[] = $_GET['age'];
}
$sql = "SELECT * FROM users";
// a smart code to add all conditions, if any
if ($conditions)
{
$sql .= " WHERE ".implode(" AND ", $conditions);
}
// the usual prepare/bind/execute/fetch routine
$stmt = $mysqli->prepare($sql);
$stmt->bind_param(str_repeat("s", count($parameters)), ...$parameters);
$stmt->execute();
$b = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
if($b) {
print_r($b);
} else {
echo "0 results";
}
$b = $conn->query("SELECT * FROM users WHERE name = 'alex'")->fetch_all(MYSQLI_ASSOC);
if($b) {
print_r($b);
} else {
echo "0 results";
}