SELECT s.server_name FROM mod_name m LEFT OUTER JOIN(
SELECT m_mod, m_serv FROM server_mod
) q ON q.m_mod = mod_id
LEFT OUTER JOIN(
SELECT server_id, server_name FROM servers
) s ON s.server_id = q.m_serv WHERE mod_id = 5
<?php
$shablon = mysqli_query($connection, "SELECT * FROM `videos` WHERE ");
while($vidos = mysqli_fetch_assoc($shablon)){
?>
<ul>
<li>
<div class="videos_image">
<a href="shablon.php?id=<?php echo $v['id']; ?>"><img src="/media/images/<?php echo $v['img']?>" width="250" height="180" alt="<?php echo $v['title']?>" /></a>
<div id="videos_image">
<img src="/media/views.png" id="views" />
<span class="videos_views"><?php echo $vidos['views'] ?></span>
</div>
</div>
<?php
if (empty($videos)) die('В базе нет никаких картинок или запрос кривой');
?>
<div class="videos_title">
<span class="title_alt"><?php echo mb_substr($v['title'], 0, 26, 'utf-8') . '...';?> </span>
</div>
</li>
</ul>
<?}?>
$myrow = mysql_num_rows($result);
if ($myrow == 1){
$_SESSION['login'] = $myrow['login'];
$_SESSION['id'] = $myrow['id'];
}
$row = mysql_fetch_array($result);
$myrow = mysql_num_rows($result);
if ($myrow == 1){
$_SESSION['login'] = $row['login'];
$_SESSION['id'] = $row['id'];
}
$sql = "SELECT * FROM `Account` WHERE `id_client` = ". (int) $_SESSION['id'];
<div id="tmenu" class="ui_tmenu">hi</div>
<form id="test" name="login" method="post">
<div class="label"> Логин </div>
<div class="i_a_i">
<input name="name" type="text" class="inp_auth">
</div>
<div class="label"> Пароль </div>
<div class="">
<input name="pass" type="text" class="inp_auth">
</div>
</form>
<button class="btn_auth">Войти</button>
<button class="btn_auth b_a_i">Регистрация</button>
$('.btn_auth').click(function(){
document.getElementById("tmenu").innerHTML='ok';
var msg = $('#test').serialize();
$.ajax({
url: "logina.php",
method: "post",
data: msg,
dataType:"json",
success: function(data) {
$('#tmenu').text(data.status);
},
error: function() { document.getElementById("tmenu").innerHTML='err';
}
});
});
require_once 'dy_functions.php';
if (isset($_POST['name'])){
$login = sanitizeString($_POST['name']);
$pass = sanitizeString($_POST['pass']);
if ($login == "" || $pass == ""){
$error = "Данные введены не во все поля";
}else{
$result = queryMysql("SELECT login,pass FROM customer WHERE login='$login' AND pass='$pass'");
if($result->num_rows == 0){
$error = "Ошибка при вводе пары имя пользователя - пароль";
}else{
$_SESSION['name'] = $login;
$_SESSION['pass'] = $pass;
$error = "все прошло успешно";
}
}
$data = array("status" => $error);
echo json_encode($data);
}
$query = $pdo->prepare('SELECT COUNT(*) FROM users WHERE login = :login AND password = :password');
$query->execute(array(':login'=>$login, ':password' =>$password));
if($query->fetchColumn() == 1){
echo "wer";
}
else
{
echo "newer";
}
<!--Я сделал небольшую форму, для тестирования.
Вы ведь делаете авторизацию, значит данные будут вводится в форму -->
<form class="aut-form" method="post">
<input name="login" type="text" placeholder="логин">
<input name="password" type="password" placeholder="пароль">
</form>
<div id="information"></div>
<input id="load" type="submit" placeholder="отправить">
function funcBeore () {
$('#information').text ('Ожидаенние');
}
$(document).ready (function(){
$("#load").bind("click", function(){
var dataAjax = $('.aut-form').serialize(); // пример заточен под использование формы
$.ajax({
url: "check_login.php",
type: "POST",
data: "data=''&" + dataAjax,
dataType: 'html',
beforeSend: funcBeore,
success: function (data){
alert(data);
if(data == "wer"){
$('#information').text(data);
}
}
});
});
});
if(isset($_POST['data'])){
$login = $_POST['login'];
$password = $_POST['password'];
$query = $pdo->prepare('SELECT COUNT(*) FROM users WHERE login = :login AND password = :password');
$query->execute(array(':login'=>$login, ':password' =>$password));
if($query->fetchColumn() == 1){
echo "wer";
}else{
echo "newer";
}
}
if(isset($_SESSION['steamid'])) {
$stmt = $pdo->prepare('SELECT * FROM St***');
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_LAZY))
{
echo '<form method ="post">';
echo '<input hidden="hidden" type="text" name="dataid" value='.$row['Steam_id'].'>';
echo '<input class="btn btn-default" type="submit" name="clickfornotice" value='.$row['Nickname'].'>';
echo '</form>';
}
}
$str_len = strlen($row['text']);
if ($str_len > '30'){
$row['text'] = mb_substr($row['text'], 0, 30);
$i=strlen(trim($row['text']));
$s = false;
while($s && $i>0) {
if (mb_substr($row['text'], $i-1, 1)==' ')
$s = true;
$row['text'] = mb_substr($row['text'], 0, -1);
$i--;
}
}
array(10) {
[""]=>
array(8) {
[0]=>
string(1) "1"
["id"]=>
string(1) "1"
[1]=>
string(7) "asdasdf"
["tittle"]=>
string(7) "asdasdf"
[2]=>
string(11) "dsfdfdfdsfd"
["link"]=>
string(11) "dsfdfdfdsfd"
[3]=>
string(4) "none"
["parent"]=>
string(4) "none"
}
array(10) {
[""]=>
array(4) {
["id"]=>
string(1) "1"
["tittle"]=>
string(7) "asdasdf"
["link"]=>
string(11) "dsfdfdfdsfd"
["parent"]=>
string(4) "none"
}