Folks,
I want to know where I used my htmlentities() correctly out of the 4 WHILE Loops ….
1.
[code]
//1. WHICH WHILE LOOP IS BEST ?
$i = ‘1’;
while($i<=$total_pages)
{
$query_string_2 = ‘&page=’ .intval($i);
$url = $path .htmlentities($query_string_1) .htmlentities($query_string_2); //Full URL With $_REQUEST params (Query Strings): https://localhost/Templates/url_encode_Template.php?find=keyword&tbl=links&col=keyword&max=100&page=1
if($page == $i)
{
//Bold the current Page numbered link.
echo ‘<a href=’ .'”‘ .$url .'”‘ .’>’ .'<b>’ .intval($i) .'</b>’ .'</a>’;
}
else
{
echo ‘<a href=’ .'”‘ .$url .'”‘ .’>’ .intval($i) .'</a>’;
}
$i++;
}
echo ‘<br>’;
2.
[code]
//2. WHICH WHILE LOOP IS BEST ?
$i = ‘1’;
while($i<=$total_pages)
{
$query_string_2 = ‘&page=’ .intval($i);
if($page == $i)
{
//Bold the current Page numbered link.
echo ‘<a href=’ .'”‘ .”$path” .htmlentities($query_string_1) .htmlentities($query_string_2) .'”‘ .’>’ .'<b>’ .intval($i) .'</b>’ .'</a>’;
}
else
{
echo ‘<a href=’ .'”‘ .”$path” .htmlentities($query_string_1) .htmlentities($query_string_2) .'”‘ .’>’ .intval($i) .'</a>’;
}
$i++;
}
3.
[code]
//3. WHICH WHILE LOOP IS BEST ?
$i = ‘1’;
while($i<=$total_pages)
{
$query_string_2 = ‘&page=’ .intval($i);
$url = $path .$query_string_1 .$query_string_2; //Full URL With $_REQUEST params (Query Strings): https://localhost/Templates/url_encode_Template.php?find=keyword&tbl=links&col=keyword&max=100&page=1
if($page == $i)
{
//Bold the current Page numbered link.
echo ‘<a href=’ .'”‘ .htmlspecialchars($url) .'”‘ .’>’ .'<b>’ .intval($i) .'</b>’ .'</a>’;
}
else
{
echo ‘<a href=’ .'”‘ .htmlspecialchars($url) .'”‘ .’>’ .intval($i) .'</a>’;
}
$i++;
}
echo ‘<br>’;
4.
[code]
//4. WHICH WHILE LOOP IS BEST ?
$i = ‘1’;
while($i<=$total_pages)
{
$query_string_2 = ‘&page=’ .intval($i);
$url = $path .htmlentities($query_string_1) .htmlentities($query_string_2); //Full URL With $_REQUEST params (Query Strings): https://localhost/Templates/url_encode_Template.php?find=keyword&tbl=links&col=keyword&max=100&page=1
if($page == $i)
{
//Bold the current Page numbered link.
echo ‘<a href=’ .'”‘ .htmlspecialchars($url) .'”‘ .’>’ .'<b>’ .intval($i) .'</b>’ .'</a>’;
}
else
{
echo ‘<a href=’ .'”‘ .htmlspecialchars($url) .'”‘ .’>’ .intval($i) .'</a>’;
}
$i++;
}
echo ‘<br>’;
?>