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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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=\"$topictext\" 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!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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.
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=\"$topictext\" 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!