look at the code first,

<?php $name=$_POST['name']; ?>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="name">
<input type="submit" value="GO" name="submit">
</form>

<?php

	include ('db.php');
	
	if(isset($_POST['submit'])) 
	{
	mysql_query ("INSERT INTO example (name) VALUES('$name')") or die(mysql_error());
	}

	if (!isset($_GET['startrow']) or !is_numeric($_GET['startrow'])) {
	$startrow = 0;
	} 
	else {
	$startrow = (int)$_GET['startrow'];
	}
	
$query = "SELECT * FROM example ORDER BY id DESC LIMIT $startrow, 20"; 

$result = mysql_query($query) or die(mysql_error());
	while($row = mysql_fetch_array($result)){
	echo "<li>";
	echo $row['name'] ." "." <a href= 'like.php?quote=" . urlencode( $row['name'] ) . "'>Click Here</a>";
	echo "</li>";
}

	

	
	echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow+10).'">Next</a>';
?>

I want to make my page links hidden , how can i make then hidden so that a user cant edit it.:(


2nd question,

currently i am showing total 10 records on each page and then a next page button , but the next button is keep showing even when there is no more records...! how to remove a next page button when records ended. ??


line number 28 is the link to pages which can be easyily editable by any user, i wnat to make them secure (using ID)

and line 35 is n'next' page link , this link should not be appear when number of records ended

i want to echo the link but i want to hide them in addressbar.
for example,

the url to every mysql shpuld be like this

http://localhost/like.php?id=4

my current links are like this,

http://localhost/php/like.php?quote=first+quote

i have only one quote 'first+quote' but when in the address bar i am replacing 'first+quote' with something else then the blank page is still opening :(
it should show the error that link not found.

this will help you count the no of rows returned..use this method to fix the problem of next pge http://php.net/manual/en/function.mysql-num-rows.php

i have counted the number of rows but i don't understand how 'if' condition should be applied to hide the 'next' page button on the last page

Member Avatar
diafol

If you have a strong validation routine, showing the querystring in the address bar should not be a problem. If you hit a querystring value that does not relate to an allowed value (page no.), just set it to page 1. The alternative to using a querystring is pure hassle and totally unnecessary.