0

please help me. this my trouble
Notice: Undefined index: p in C:\wamp\www\index.php on line 7
and soure

<?php
session_start ();
include ("function.php");
$title = "Trang chủ";
include ("header.php");

$p_now = intval($_GET ['p']);
$total = mysql_result ( mysql_query ( "SELECT COUNT(id) FROM baiviet WHERE kieu='post'" ), 0 );
$numofpages = $total / $pp;

if ($p_now<=0) {
	$page = 1;
} else {
	if($p_now <= ceil($numofpages))
		$page = $p_now;
	else
		$page = 1;
}

$limitvalue = $page * $pp - ($pp);
$query = "SELECT * FROM baiviet WHERE kieu='post'  ORDER BY id DESC LIMIT $limitvalue, $pp ";

$result = mysql_query ( $query );
while ( $row = mysql_fetch_array ( $result ) ) {
	?>
<br />
<div class="check"><a href="baiviet.php?id=<?=$row ['id'];?>"><?=$row ['tieude'];?> :</a></div>
<div><a href="upload/image/<?=$row ['hinhanh'];?>" class="preview"
	title="<?=$row ['tieude'];?>"><img
	src="upload/image/thumbs/<?=$row ['hinhanh'];?>" border="0"
	align="left" /></a>
<p><b>Lượt xem :</b> <?=$row ['view'];?><br />
<b>Ngày gửi :</b> <?=date ( 'd/m/Y \l\ú\c H:i:s', $row ['thoigian'] );?><br />
<b>Chuyên mục :</b> <a
	href="chuyenmuc.php?id=<?=$row ['catID'];?>"><?=getparentname ( $row ['catID'] );?></a><br />
<b>Tag :</b> <?=$row ['tag'];?><br />


<p><?=$row ['gioithieu'];?><a href="baiviet.php?id=<?=$row ['id'];?>">[ Chi tiết ...]</a></p>

</div>
<div class="clear"></div>


<?php
}
echo "<div class=\"center\">";
page_div ( "?p=%d_pg", "10", ceil ( $numofpages ), $page );
echo "</div>";
mysql_close ();
include ("footer.php")?>

==========================================
Notice: Undefined index: username in C:\wamp\www\header.php on line 37
this code

<?php
if (checkadmin ( $_SESSION ['username'] ) && $_GET ['page'] == 'addpost' || $_GET ['page'] == 'editpost') {
	?>

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by karthik_ppts
0

Replace your line 7 with

$p_now=0;
if(isset($_GET['p']) && !empty($_GET['p'])
     $p_now = intval($_GET ['p']);

Use code tags to post your code

0

Replace your line 7 with

$p_now=0;
if(isset($_GET['p']) && !empty($_GET['p'])
     $p_now = intval($_GET ['p']);

Use code tags to post your code

thanhks :*

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.