[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: ошибка в табуляции
gerdert
немогу исправить ошибку slider от jquery при переключании по 1 передает

<?php

header("Content-Type:text/html;charset=UTF8");
include 'config.php';
include 'functions.php';

$count_tabel = get_count_tabel();
$number_pages = number_pages($count_tabel,COUNT_PER_PAGE);

if($_GET['page']) {
$page = (int)$_GET['page'];
if(!$page) {
$page = 1;
}
}

else {
$page = 1;
}

$result = get_posts($count_tabel,$page,COUNT_PER_PAGE);

if($_GET['move'] == 1) {
////
foreach($result as $row) {
printf ('
<table id="table_id" class="display">
<thead>
<tr>
<th>название</th>
<th>описание</th>
<th>игра</th>
<th> места </th>
<th>гарант</th>
<th>цена</th>
</tr>
</thead>
<tr data-href="text.php?id=%s">
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%d</td>
<td>%d</td>
<td>%d</td>

<tfoot>
<tr>
<th>название</th>
<th>описание</th>
<th>игра</th>
<th> места </th>
<th>гарант</th>
<th>цена</th>
</tr>
</tfoot>
</table>'
,$row['id'],$row['name'],$row['text'],$row['geme'],$row['colvo'],$row['ok'],$row['gold'])
}
exit();
}
}



?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />

<
script src="js/jquery-1.9.1.js"></script>
<
script src="js/jquery-ui-1.10.1.custom.js"></script>

<
link rel="stylesheet" href="css/style.css"/>
<
link rel="stylesheet" href="css/jquery-ui-1.10.1.custom.css">

<
script type="text/javascript">
jQuery( function($) {
$('tr:even').css({'background-color' : '#d9d8df'});
$('tbody tr[data-href]').addClass('clickable').click( function() {
window.location = $(this).attr('data-href');
}).find('a').hover( function() {
$(this).parents('tr').unbind('click');
}, function() {
$(this).parents('tr').click( function() {
window.location = $(this).attr('data-href');
});
});
});
</
script>
</
head>

<
body>

<
script>
$(document).ready(function () {

$(".load").hide();

$("#slider").slider({
step:1,
min:1,
max:<?=$number_pages;?>,
stop: function(event, ui) {
$(".load").fadeIn(300,function() {
$.ajax({
url:'index.php',
type:'GET',
data: "page="+ui.value+"&move=1",
success: function(html) {
$(".load").fadeOut(300,function() {
///
$(".main_text").html(html).hide().fadeIn(300);
$(".ui-slider-handle span").text(ui.value);
});
}

}
);

});
}

}
);
$("#slider").slider("option","value",<?=$page;?>);
$(".ui-slider-handle").html("<span>"+$("#slider").slider("value")+"</span>");
$("#next").click(function() {
var val_slide = $("#slider").slider("value")
if(val_slide < (<?=$number_pages;?>)) {
val_slide += 1;
$("#slider").slider("option","value",val_slide);
$(".load").fadeIn(300,function() {
$.ajax({
url:'index.php',
type:'GET',
data: "page="+val_slide+"&move=1",
success: function(html) {
$(".load").fadeOut(300,function() {
///
$(".main_text").html(html).hide().fadeIn(300);
$(".ui-slider-handle span").text(val_slide);
});
}

}
);

});
}

}
);

$("#prev").click(function() {
var val_slide = $("#slider").slider("value")
if(val_slide > 1) {
val_slide -= 1;
$("#slider").slider("option","value",val_slide);
$(".load").fadeIn(300,function() {
$.ajax({
url:'index.php',
type:'GET',
data: "page="+val_slide+"&move=1",
success: function(html) {
$(".load").fadeOut(300,function() {
///
$(".main_text").html(html).hide().fadeIn(300);
$(".ui-slider-handle span").text(val_slide);
});
}

}
);

});
}

}
);
});

</
script>


<
div class="wrap">

<
div class='header'>
<? echo '<h2>'.$site_name.'</h2>';?>
<hr>
</
div>

<
div class='content'>

<
div class="main_text">
<?
foreach($result as $row) {

printf ('
<table id="table_id" class="display">
<thead>
<tr>
<th>название</th>
<th>описание</th>
<th>игра</th>
<th> места </th>
<th>гарант</th>
<th>цена</th>
</tr>
</thead>
<tr data-href="text.php?id=%s">
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
</tr>
<tfoot>
<tr>
<th>название</th>
<th>описание</th>
<th>игра</th>
<th> места </th>
<th>гарант</th>
<th>цена</th>
</tr>
</tfoot>
</table>'
,$row['id'],$row['name'],$row['text'],$row['geme'],$row['colvo'],$row['ok'],$row['gold'])}
?>
</div>
<
hr>
<
div class="load"></div>
<?
if($number_pages) {
echo "
<div style='width:330px;height:40px;margin:0 auto;'>
<a id='prev'></a>
<div style='width:150px;float:left;margin-top:12px'>
<div id='slider'></div>
</div>
<a id='next'></a>

</div>

"
;
}
?>
</div>

<
div class='footer'>
<
hr>
<? echo "<p style='text-align:right;font_size:5px;'>".$site_name."</p>";?>
</div>
</
div>
</
body>
</
html>






<?php
function
get_tabel() {
$result = mysql_query("SELECT id,name,text,geme,colvo,ok,gold
FROM tabel"
);
if (!$result){
exit("<p>В базе данных не обнаружено таблицы проверте настройки</p>");
}
if(mysql_num_rows($result) == 0) {
exit('Статтей нет');
}
$row = array();
for($i = 0; $i < mysql_num_rows($result); $i++) {
$row[] = mysql_fetch_array($result,MYSQL_ASSOC);
}
return $row;
}
function get_count_tabel() {
$sql = 'SELECT COUNT(*) FROM tabel';
$result = mysql_query($sql);

if(!$result) {
exit(mysql_error());
}

return mysql_result($result,0);
}

function number_pages($count_tabel,$count_per_page) {

if($count_tabel < $count_per_page) {
return FALSE;
}

$number_pages = (int)($count_tabel/$count_per_page);

if(($count_tabel%$count_per_page) != 0) {
$number_pages++;
}

return $number_pages;
}

function get_posts($count_tabel,$page,$count_per_page) {

$start = ($page - 1)*$count_per_page;

$sql = "SELECT id,name,text,geme,colvo,ok,gold
FROM tabel
ORDER BY id
LIMIT "
.$start.",".$count_per_page;
$result = mysql_query($sql);

if (!$result){
exit("<p>В базе данных не обнаружено таблицы проверте настройки</p>");
}
if(mysql_num_rows($result) == 0) {
exit('Статтей нет');
}

$row = array();
for($i = 0; $i < mysql_num_rows($result); $i++) {
$row[] = mysql_fetch_array($result,MYSQL_ASSOC);
}
return $row;

}
?>





Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2025 Invision Power Services, Inc.