Jump to content

Can anyone paginate this??


aznjay

Recommended Posts


<div id="contrax">
<?
include 'database.php';

if(isset($_GET['id']) && is_numeric($_GET['id']))
{
    $id = $_GET['id'];

    $sql  = "SELECT * FROM phptut WHERE id='$id'";
    $result = mysql_query($sql);

    if(mysql_num_rows($result) == 1)
    {
        $row = mysql_fetch_assoc($result);
	echo '<div id="titlecon">';
	echo $row['title'];
	echo '</div>';
	echo "<br>";
	echo '<div id="cont">';
        echo $row['article'];
	echo '</div>';
    }
}
else
{


    $sql  = 'SELECT * FROM phptut ORDER BY id ASC';
    $result = mysql_query($sql);


function strLength($str,$len){
    $lenght = strlen($str);
    if($lenght > $len){
        return substr($str,0,$len).'...';
    }else{
        return $str;
    }

}

   while($row = mysql_fetch_assoc($result))
   {
        echo '<div id="tutorial"><a href="'.$_SERVER['REQUEST_URI'].'&id='.$row['id'].'">'.$row['title'].'</a></div>';


$str = $row['article'];
//The fist part is the string, the second part is how long it can be
echo '<div id="tutorial2">';
echo strLength($str,250);
echo '<a href="'.$_SERVER['REQUEST_URI'].'&id='.$row['id'].'">Read More</a>';
echo '</div>';

   }
}
?>
</div>

 

I having trouble paginating this...can anyone do a paging?

Link to comment
https://forums.phpfreaks.com/topic/124700-can-anyone-paginate-this/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.