INSERT INTO `users` (`login`, `password`, `email`, `reg_date`) VALUES ('rachok', '".md5("123")."', '".time()."')
class Database {
private $host = "localhost";
private $adm = "root";
private $pass = "";
private $db;
private $sql;
public $user;
function __construct($db) {
$this->db = $db;
$this->connect($this->db);
}
public function connect($db) {
$this->sql = mysqli_connect($this->host, $this->adm, $this->pass, $db);
}
public function select($username, $password) {
$this->user = mysqli_query($this->sql, "SELECT `id` FROM `users` WHERE `username` = '$username' AND `password` = '$password'");
return mysqli_fetch_array($this->user);
}
}
$db = "netbook";
$user = $_POST['user'];
$pass = $_POST['password'];
$bd_user = new Database ($db);
$val_uset = $bd_user -> select($user, $pass);
$connect = mysqli_connect("localhost", "user", "password", "test"); // соединение с бд "test"
$sql = "SELECT * FROM `films`"; // строка sql запроса, для возврата всех строк таблицы films
$result = mysqli_query($connect, $sql); // выполнение запроса...
while ($res = mysqli_fetch_assoc($result)) { // преобразуем в ассоциативный массив и перебираем в цикле
echo $res['name']." (".$res['year'].")\n"; //на каждой итерации тут данные новой строки
}
<?php
require_once('db.php');
?>
<form method="post" action="">
<input type="date" name="delivery_date">
<input type="submit" value="Найти">
</form>
<?
if(isset($_POST['delivery_date']))
{
$date = $_POST['delivery_date'];
$SQL = "SELECT * FROM $dbtable WHERE delivery_date = '$date' AND delivery = 1";
$result = mysqli_query($link, $SQL);
while ($res = mysqli_fetch_assoc($result))
{
echo $res["user"]." (".$res["delivery_date"].")<br>";
}
}
?>