Good day, morning, night? It's dark, so that makes it sleepy bye time.
Bit before I do, I'm trying to work this out.
I have a little bit of code to print Next n>> articles in my database.
Can someone help me straighten out these lines of code, pretty please
... before I go fleeping nuts :)

if(!$rendu)
{
$rendu = 0;
}
$nombre = 10;

$news = mysql_query("select * from $table ORDER by DT desc");
$num_rows = mysql_num_rows($news);

$nouveau = $rendu + $nombre;
if ($nouveau < $num_rows)
{
    if ($nombre < $num_rows)
    {
    $nouveau = $num_rows - $nombre;
    #when there are 23 articles, and I am number 20 on the screen, I
want to display the remaining 3, not ten.
    }
$myinsert  = " <font face=\"arial\" size=2><A
HREF=\"index.html?rendu=".$nouveau."\">Next ".$nouveau." Articles
&gt;&gt;</a></font>\n";

}

John

################################################################################

<?php

if(!$rendu)
{
$rendu = 0;
}
$nombre = 10;

################################################################
#$myconnection = mysql_pconnect($server,$user,$pass);
 $myconnection = mysql_connect($server,$user,$pass);

 mysql_select_db($db,$myconnection);

 $news = mysql_query("SHOW TABLE STATUS FROM ".$db." LIKE '$table'");
 while ($news_story = mysql_fetch_array($news))
  {
         $table_comment = $news_story['Comment'];
  }

$news = mysql_query("select * from $table ORDER by DT desc");
$num_rows = mysql_num_rows($news);

$news = mysql_query("select * from $table ORDER by DT desc LIMIT
$rendu,$nombre");

$old_WHO = "";

 while ($mydata = mysql_fetch_object($news))
      {
 $mydata->RQ = str_replace("\r", "", $mydata->RQ);
 $mydata->RQ = str_replace("\n", "<br>", $mydata->RQ);
 $mydata->RQ = str_replace("<br><br>", "<p>", $mydata->RQ);
 $mydata->CM = str_replace("\r", "", $mydata->CM);
 $mydata->CM = str_replace("\n", "<br>", $mydata->CM);
 $mydata->CM = str_replace("<br><br>", "<p>", $mydata->CM);

 ############### Display WHO Once ########
 if ($old_WHO != $mydata->WHO) #when WHO occurs the first time, echo it
once only.
        {
        $old_WHO = $mydata->WHO;
        $body .= "<b>From ".$mydata->WHO.":</b>";
        }
 ############## Description ###############
 if($mydata->RQ)
 $body .= "<ol>".$mydata->RQ."</ol>\n";
 ############## Description ###############
 if($mydata->CM)
 $body .= "<ol><small>".$mydata->DT." - <font
color=\"blue\"><i>".$mydata->CM."</i></font></small></ol><br>\n";

 }#end of while
 mysql_close($myconnection);


#####################################################
$nouveau = $rendu + $nombre;
if ($nouveau < $num_rows)
{
if ($nouveau < $num_rows)
{
$nouveau = $num_rows - $nouveau ;
}
$myinsert  = " <font face=\"arial\" size=2><A
HREF=\"index.html?rendu=".$nouveau."\">Next ".$nouveau." Articles
&gt;&gt;</a></font>\n";

}
#####################################################

echo "<h2 align=center>".$table_comment."</h2>
<ul>
<h3>$course_description</h3>
.. $myinsert<br>
.. $num_rows<br>
.. $nouveau = $rendu + $nombre<br>
if ($nouveau < $num_rows)<br>
<ol>
$body
</ol>
<hr>
</ul>";

?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to