Помощь по скриптам | Код
помогите пож почему пишет ошибка бд?
<?php
require_once('conf/dbc.php');
require_once('conf/session_start.php');
require_once('conf/ban.php');
if ((!isset($_SESSION['id'])) or (!isset($_SESSION['nick']))) {
?>
<script type="text/javascript">
document.location.href = "reg.php?err_login=1";
</script>
<?php
};
$page_title = 'Техподдержка';
require_once('conf/head.php');
require_once('conf/top.php');
//////////////////////////////////////
?>
<?php
$messages = $_GET['messages'];
$user_id = $_SESSION['id'];
$query1 = "Select * from users where id='$user_id' limit 1";
$result1 = mysqli_query($dbc, $query1) or die ('Ошибка передачи запроса к БД');
$row1 = mysqli_fetch_array($result1);
$admin = $row1['admin'];
$user = $row1['user'];
$query12 = "Select * from users where id='$mes' limit 1";
$result12 = mysqli_query($dbc, $query12) or die ('Ошибка передачи запроса к БД');
$row12 = mysqli_fetch_array($result12);
$nick = $row12['nick'];
$avatar = $row12['avatar'];
$gruppa = $row12['gruppa'];
$on = $row12['on'];
$query_num = "Select mes_id from texpod where reading = '0'" ;
$result_num = mysqli_query($dbc, $query_num) or die ('Ошибка передачи запроса к БД0');
$total6 = mysqli_num_rows($result_num);
$message = $total6;
?>
<?php if ($user != '1') {?>
<?php if (!empty($mes)) {?>
<center><p class="podmenu" style="border-top:1px solid #444e4f; background-color:#1c252f;"><?php echo "$nick";?></p></center>
<div style="float: left;">
<img src="img/ava/<?php echo "$avatar";?>.png" width="50" height="50" />
</div> <?php
if ($gruppa == 'svoboda') {if ($on == '1' ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php }}
if ($gruppa == 'dolg') {if ($on == '1' ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php }}
if ($gruppa == 'naemniki') {if ($on == '1' ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/odinochkion.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/odinochkion.png" width="12" height="12" alt="н"/><?php }}
?><a href="profile.php?id=<?php echo "$mes";?>"><?php echo "$nick";?></a><br/>
<div style="clear: left;">
</div>
<p class="podmenu" style="border-top:1px dashed #444e4f;"></p>
<p>Сообщение:</p>
<center>
<form enctype="multipart/form-data" method="post" action="tex_act.php?mes=<?php echo "$mes";?>&flag=1">
<textarea rows="2" style="width:98%; height:60px;" cols="35px" name="say"></textarea>
<div class="knopka">
<input type="submit" style="width:74px;" class="input" value="Отправить" name="addad"/>
</div>
</form></center>
<p class="podmenu" style="border-top:1px dashed #444e4f;"></p>
<?php
$query_us = "Select * from texpod where ot = '$mes' order by time DESC";
$result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
while ($row_us = mysqli_fetch_array($result_us)) {
$idlo = $row_us['mes_id'];
$text = $row_us['text'];
$otvet = $row_us['otvet'];
$time = $row_us['time'];
$time1 = $row_us['time1'];
$reading = $row_us['reading'];
?>
<div style="background-color: <?php if ($reading == '0') {?>#575757<?php } else {?>#1E1E1E<?php }?>;">
<?php if (!empty($otvet)) {?><div style="background-color: #000000;">Я: <span class="white"><?php echo "$otvet";?></span> <small><?php echo "$time1";?></small></div><?php }?>
Он: <span class="white"><?php echo "$text";?></span> <small><?php echo "$time";?></small>
</div>
<?php
$query = "update texpod set reading='1' where mes_id = '$idlo' limit 1";
$result = mysqli_query($dbc, $query) or die ('Ошибка передачи запроса к БД');
?>
<?php
}
?>
<p class="podmenu" style="border-top:1px solid #444e4f;"></p>
<p><a href="tex_list.php" class="menu"><img src="img/reload.gif" width="12" height="12" /> Назад</a></p>
<p class="podmenu" style="border-top:1px solid #444e4f;"></p>
<?php } else {?>
<div class="stats">
<center><p class="podmenu" style="
<?php
require_once('conf/dbc.php');
require_once('conf/session_start.php');
require_once('conf/ban.php');
if ((!isset($_SESSION['id'])) or (!isset($_SESSION['nick']))) {
?>
<script type="text/javascript">
document.location.href = "reg.php?err_login=1";
</script>
<?php
};
$page_title = 'Техподдержка';
require_once('conf/head.php');
require_once('conf/top.php');
//////////////////////////////////////
?>
<?php
$messages = $_GET['messages'];
$user_id = $_SESSION['id'];
$query1 = "Select * from users where id='$user_id' limit 1";
$result1 = mysqli_query($dbc, $query1) or die ('Ошибка передачи запроса к БД');
$row1 = mysqli_fetch_array($result1);
$admin = $row1['admin'];
$user = $row1['user'];
$query12 = "Select * from users where id='$mes' limit 1";
$result12 = mysqli_query($dbc, $query12) or die ('Ошибка передачи запроса к БД');
$row12 = mysqli_fetch_array($result12);
$nick = $row12['nick'];
$avatar = $row12['avatar'];
$gruppa = $row12['gruppa'];
$on = $row12['on'];
$query_num = "Select mes_id from texpod where reading = '0'" ;
$result_num = mysqli_query($dbc, $query_num) or die ('Ошибка передачи запроса к БД0');
$total6 = mysqli_num_rows($result_num);
$message = $total6;
?>
<?php if ($user != '1') {?>
<?php if (!empty($mes)) {?>
<center><p class="podmenu" style="border-top:1px solid #444e4f; background-color:#1c252f;"><?php echo "$nick";?></p></center>
<div style="float: left;">
<img src="img/ava/<?php echo "$avatar";?>.png" width="50" height="50" />
</div> <?php
if ($gruppa == 'svoboda') {if ($on == '1' ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php }}
if ($gruppa == 'dolg') {if ($on == '1' ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php }}
if ($gruppa == 'naemniki') {if ($on == '1' ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/odinochkion.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/odinochkion.png" width="12" height="12" alt="н"/><?php }}
?><a href="profile.php?id=<?php echo "$mes";?>"><?php echo "$nick";?></a><br/>
<div style="clear: left;">
</div>
<p class="podmenu" style="border-top:1px dashed #444e4f;"></p>
<p>Сообщение:</p>
<center>
<form enctype="multipart/form-data" method="post" action="tex_act.php?mes=<?php echo "$mes";?>&flag=1">
<textarea rows="2" style="width:98%; height:60px;" cols="35px" name="say"></textarea>
<div class="knopka">
<input type="submit" style="width:74px;" class="input" value="Отправить" name="addad"/>
</div>
</form></center>
<p class="podmenu" style="border-top:1px dashed #444e4f;"></p>
<?php
$query_us = "Select * from texpod where ot = '$mes' order by time DESC";
$result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
while ($row_us = mysqli_fetch_array($result_us)) {
$idlo = $row_us['mes_id'];
$text = $row_us['text'];
$otvet = $row_us['otvet'];
$time = $row_us['time'];
$time1 = $row_us['time1'];
$reading = $row_us['reading'];
?>
<div style="background-color: <?php if ($reading == '0') {?>#575757<?php } else {?>#1E1E1E<?php }?>;">
<?php if (!empty($otvet)) {?><div style="background-color: #000000;">Я: <span class="white"><?php echo "$otvet";?></span> <small><?php echo "$time1";?></small></div><?php }?>
Он: <span class="white"><?php echo "$text";?></span> <small><?php echo "$time";?></small>
</div>
<?php
$query = "update texpod set reading='1' where mes_id = '$idlo' limit 1";
$result = mysqli_query($dbc, $query) or die ('Ошибка передачи запроса к БД');
?>
<?php
}
?>
<p class="podmenu" style="border-top:1px solid #444e4f;"></p>
<p><a href="tex_list.php" class="menu"><img src="img/reload.gif" width="12" height="12" /> Назад</a></p>
<p class="podmenu" style="border-top:1px solid #444e4f;"></p>
<?php } else {?>
<div class="stats">
<center><p class="podmenu" style="