Menu

How would I....

Help
2000-08-22
2000-08-25
  • Kelly Hamlin

    Kelly Hamlin - 2000-08-22

    Im wanting to add in my header.php3 in my themes dir, i want the ability to display the last 5 headlines and link to them, i sorta had it figured out by taking the code slashdot theme uses and modifying it, but in the end screwed it up big time. If anyone could assist me in this i would appriciate it
    thanks

     
    • Anonymous

      Anonymous - 2000-08-25

      Just re-copy the part in the Slashdot theme's header.php3 file.  Then change the limit part of the SQL query to be 1,5 and not 3,5.  If left on 3,5 it will choke on any situation with fewer than three articles posted.

       
      • Kelly Hamlin

        Kelly Hamlin - 2000-08-25

        This is the code
        more than the 3,5 5,5 0,5 problem, ive got that figured out.

        here is the code.
        <?php
        mysql_pconnect($dbhost, $dbuname, $dbpass);
        $result = mysql_query("select topic from stories order by sid DESC limit 5,5");
        echo "<center>";
        while(list($topic) = mysql_fetch_row($result)) {
            $result2 = mysql_query("select topicid, topicimage, topictext from topics where topicid='$topic'");
            list($topicid, $topicimage, $topictext) = mysql_fetch_row($result2);
            echo "<a href=search.php3?query=&topic=$topicid><img src=$tipath$topicimage hspace=10 Alt=\&quot;$topictext\&quot; border=0></a>";
        }
        echo "</center>";
        mysql_free_result($result);
        mysql_free_result($result2);
        ?>

        if i make it 0,5 it takes the first headline instead of skipping 5. However i dont know the correct sql query statements to make it take headline from story ect.  any assistance would be great!

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.