mysql — новые записи, добавленные в mysqladmin, не отображаются на странице php

У меня есть 300 записей в таблице mysqladminи я отображаю записи в php страница, это отлично работает. но когда я добавляю новые записи, это номер записи. 301,302 и так далее, он добавляет записи в таблицу, но не отображается в php стр. я использую простой запрос в php страница, я просто укажу запрос, который я использовал в php стр.

$sql = " SELECT * FROM td_table ";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);

ВОПРОС ОБНОВЛЕНО

<?php

$uq=mysql_query("select user_fullname from td_user where user_id='".$_SESSION['use_i']."'");
$u_row=mysql_fetch_object($uq);// How many adjacent pages should be shown on each side?
$adjacents = 3;

/*
First get total number of rows in data table.
If you have a WHERE clause in your query, make sure you mirror it here.
*/
$condition='1 = 1';
$q='';
if(isset($_REQUEST['cname']))
{

$q.='&cname='.$_REQUEST['cname'];
$condition.=" AND Vehicle_description like '%".$_REQUEST['cname']."%'";
}
if(isset($_REQUEST['modelno']))
{

$q.='&modelno='.$_REQUEST['modelno'];
$condition.=" AND Model like '%".$_REQUEST['modelno']."%'";
}
if(isset($_REQUEST['modelno']))
{

$q.='&year='.$_REQUEST['year'];
$condition.=" AND Year like '%".$_REQUEST['year']."%'";
}
$query = "SELECT COUNT(*) as num FROM td_table where $condition";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages['num'];

/* Setup vars for query. */
$targetpage = "automobile_list.php";    //your file name  (the name of this file)
$limit = 1;                                 //how many items to show per page
$page = @$_GET['page'];
if($page)
$start = ($page - 1) * $limit;          //first item to display on this page
else
$start = 0;                             //if no page var is given, set start to 0

/* Get data. */
/* $vins = "SELECT SUBSTRING(VIN, 1, 10) FROM td_table"; */

$sql = " SELECT * FROM td_table where  $condition LIMIT $start, $limit ";
$result = mysql_query($sql);

/* Setup page vars for display. */
if ($page == 0) $page = 1;                  //if no page var is given, default to 1.
$prev = $page - 1;                          //previous page is page - 1
$next = $page + 1;                          //next page is page + 1
$lastpage = ceil($total_pages/$limit);      //lastpage is = total pages / items per page, rounded up.
$lpm1 = $lastpage - 1;                      //last page minus 1

/*
Now we apply our rules and draw the pagination object.
We're actually saving the code to a variable in case we want to draw it more than once.
*/
$pagination = "";
if($lastpage > 1)
{
$pagination .= "<div class=\"pagination\">";
//previous button
if ($page > 1)
$pagination.= "<a href=\"$targetpage?page=$prev&q=$q\">< previous</a>";
else
$pagination.= "<span class=\"disabled\">< previous</span>";

//pages
if ($lastpage < 7 + ($adjacents * 2))   //not enough pages to bother breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage?page=$counter&q=$q\">$counter</a>";
}
}
elseif($lastpage > 5 + ($adjacents * 2))    //enough pages to hide some
{
//close to beginning; only hide later pages
if($page < 1 + ($adjacents * 2))
{
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage?page=$counter&q=$q\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage?page=$lpm1&q=$q\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage?page=$lastpage&q=$q\">$lastpage</a>";
}
//in middle; hide some front and some back
elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= "<a href=\"$targetpage?page=1&q=$q\">1</a>";
$pagination.= "<a href=\"$targetpage?page=2&q=$q\">2</a>";
$pagination.= "...";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage?page=$counter&q=$q\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage?page=$lpm1&q=$q\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage?page=$lastpage&q=$q\">$lastpage</a>";
}
//close to end; only hide early pages
else
{
$pagination.= "<a href=\"$targetpage?page=1&q=$q\">1</a>";
$pagination.= "<a href=\"$targetpage?page=2&q=$q\">2</a>";
$pagination.= "...";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage?page=$counter&q=$q\">$counter</a>";
}
}
}

//next button
if ($page < $counter - 1)
$pagination.= "<a href=\"$targetpage?page=$next&q=$q\">next ></a>";
else
$pagination.= "<span class=\"disabled\">next ></span>";
$pagination.= "</div>\n";
}
?>
<!--/menu_section-->

<div class="paginaton">
<?php echo $pagination;?>
<!--<ul class="paginate clear">
<li><a href="">Prev</a></li>
<li><a href="">1</a></li>
<li><a href="">2</a></li>
<li><a href="">3</a></li>
<li><a href="">4</a></li>
<li><a href="">5</a></li>
<li><a href="">6</a></li>
<li><a href="">Next</a></li>
</ul>-->
</div><!--/paginaton-->
<div class="container">
<div class="common" style="padding-top: 0px;">
<?php
if(mysql_num_rows($result)>0)
{
while($row = mysql_fetch_array($result))

{?>
<div class="automobilelist">
<div class="auto_list">

<div class="testonepre" style="width:auto;" align="center">
<p class="list_head">Vehicle Description</p>
</div>
<div class="clear"></div>
<div class="testone">
<div class="list_text">
<span class="list_name"> Vehicle Description : </span><span class="list_desc"> <?php echo $row['Vehicle_description'];?></span>
</div>
<div class="list_text">
<span class="list_name">Year : </span><span class="list_desc"> <?php echo $row['Year'];?></span>
</div>
<div class="list_text">
<span class="list_name">Make : </span><span class="list_desc"> <?php echo $row['Make'];?></span>
</div>
<div class="list_text">
<span class="list_name">Model : </span><span class="list_desc"> <?php echo $row['Model'];?></span>
</div>
<div class="list_text">
<span class="list_name">Body Style : </span><span class="list_desc"> <?php echo $row['Body_Style'];?></span>
</div>
<div class="list_text">
<span class="list_name">Trim : </span><span class="list_desc"> <?php echo $row['Trim_Level'];?></span>
</div>
<div class="list_text">
<span class="list_name">Odometer : </span><span class="list_desc"><?php echo $row['Odometer'];?></span>

Как это будет показывать много строк

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]