$connect = mysqli_connect("localhost", "root", "", "site");
$sql = "SELECT * FROM `users` WHERE `login` = ?";
$stmt = $connect ->prepare($sql);
$stmt->bind_param("s", $_POST['username']);
$stmt->execute();
$stmt->store_result();
if ($stmt->num_rows > 0) {
echo 'This username is already taken';
} else {
echo 'This username is available';
}
preg_match_all('~(?<=<p>).+?(?=</p>)~', $str, $match);
$data = array_map(function($n) {
return explode('-', $n, 2);
}, $match[0]);
$result = [];
if(...) {
foreach(... as ...) {
$images = $this->model_catalog_product->getProductImages($result['product_id']);
if(isset($images[0]['image']) && !empty($images)){
$images = $images[0]['image'];
} else {
$images = $image;
}
}
<picture>
<source srcset="mdn-logo-wide.png" media="(min-width: 600px)">
<img src="mdn-logo-narrow.png" alt="MDN">
</picture>