woolseyr Posted January 22, 2007 Share Posted January 22, 2007 Hi what i am trying to do is create a page that will display the newest entry in the database and have all the other entries displayed as a link underneath as past entries.I know i am missing some elements in my code. but i don't know what it is. so far what i have is one page that list all the entries with there dates and when you click on a links it calls a second page where it calls up the newest entry and links the older entries.I would prefer if i could do this on one page. where the newest entry is displayed automatically. and the older links are under it.Any help at all would be appreciated.This is probably easy to do. but i cant find what i am looking for.THis is my first page of the code[code]<?phpinclude('../db_connect.php');?><?php$sql = "SELECT * FROM parentletter_en ORDER BY letter_id DESC";$rs = mysql_query($sql) orprint ("Can't select entries from table Parent Letters.<br />" . $sql . "<br />" . mysql_error());while ($info = @mysql_fetch_array($rs)) { echo "<a href='showdetails.php?id=" . $info['letter_id'] . "'>" . $info['date'] . "<p>";}?>[/code]This is my second page of the code[code]<?phpinclude('../db_connect.php'); ?><?php$query = "SELECT letter_id, date, body FROM parentletter_en WHERE letter_id";$result = mysql_query($query) orprint ("Can't select entries from table Parent Letters.<br />" . $query . "<br />" . mysql_error());while($row = mysql_fetch_assoc($result)) { echo "<b><p><p>$date {$row['date']}</b></p></p><br><br>" . "$body {$row['body']}" ; }?>[/code] Link to comment https://forums.phpfreaks.com/topic/35264-dynamic-links-and-news-entries/ Share on other sites More sharing options...
genericnumber1 Posted January 22, 2007 Share Posted January 22, 2007 I'm not fully sure I understand what you want... could you elaborate more on what you're trying to do? Link to comment https://forums.phpfreaks.com/topic/35264-dynamic-links-and-news-entries/#findComment-166632 Share on other sites More sharing options...
woolseyr Posted January 23, 2007 Author Share Posted January 23, 2007 what i want is something like this.http://zenonpark.nesd.ca/en/listlinkies.phpBut i want it to look like this right from the starthttp://zenonpark.nesd.ca/en/showdetails.phphowever it is supposed to only show the most recent entry.and list the old entries like a link in the first page Link to comment https://forums.phpfreaks.com/topic/35264-dynamic-links-and-news-entries/#findComment-167151 Share on other sites More sharing options...
mandukar Posted January 23, 2007 Share Posted January 23, 2007 I think it would be somthing like....[quote]Welcome to the admin panel. What will you do?<ul> <li><A href=addupdate.php>Add Update</a> <li><a href=admin.php?view=donate>Donate</a> <li><a href=admin.php?view=add>Add Staff</a></ul><?phpif ($view == del) { print "<form method=post action=admin.php?view=del&step=del>Delete ID <input type=text name=did>. <input type=submit value=Delete></form>"; if ($step == del) { if ($did != 1) { mysql_query("delete from players where id=$did"); print "You deleted ID $did."; } else { print "No deleting the owner."; } }}if ($view == add) { print "<form method=post action=admin.php?view=add&step=add>Add ID <input type=text name=aid> as an <select name=rank><option value=Member>member</option><option value=Admin>admin</option></select>. <input type=submit value=Add></form>"; if ($step == add) { if ($aid != 1) { mysql_query("update players set rank='$rank' where id=$aid"); print "You added ID $aid as a $rank."; } }}?></quote]this is my admin panel and it works on the basis of what you want..where it says print you'd simple replace it with a database script to call your info from the database i think..letme know how it works out. Link to comment https://forums.phpfreaks.com/topic/35264-dynamic-links-and-news-entries/#findComment-167159 Share on other sites More sharing options...
woolseyr Posted January 23, 2007 Author Share Posted January 23, 2007 from trying the code (dont know if i did everything right). but its not working how i need it to.what i am looking for is...IF id is the newest in the list THEN printthe body of the letter.IF it isnt newest in the listthen print all the older entires as a link when clicked on opens up and you can view what it is. Link to comment https://forums.phpfreaks.com/topic/35264-dynamic-links-and-news-entries/#findComment-167265 Share on other sites More sharing options...
mandukar Posted January 23, 2007 Share Posted January 23, 2007 i'm not sure, then, sorry...thats how I do my entrys. Link to comment https://forums.phpfreaks.com/topic/35264-dynamic-links-and-news-entries/#findComment-167288 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.