Dan13071992
02-25-2012, 12:37 PM
when a user on my site clicks on the paper link (its like a newpaper) i want them to be taken to the last issue of the paper, however im not to sure how to do this with the script ive got, as i will be using the if (empty($_GET)) of if ($_GET == "") so my question is, how can i make the mysql query select as default the last id in the table?
also i see on websites, that they have a little part of an article display, then a link to read the entire article, how is this possible, its more of an "insight" i guess, is it done using css or php?
Cheers.
Dan
litebearer
02-25-2012, 01:32 PM
answers in reverse order:
They are called trailers. you simply grab x words from the front of the article and add the elipse ... (spelling). See http://www.webdeveloper.com/forum/showthread.php?t=56823
The query: use ORDER BY id DESC, the first result will be the most recent addition to your database PROVIDING your id field is auto-increment
Dan13071992
02-25-2012, 01:43 PM
I will look into this, thanks for helping me with that part, i would never of had a clue what it was called inorder to search for it
answers in reverse order:
They are called trailers. you simply grab x words from the front of the article and add the elipse ... (spelling). See http://www.webdeveloper.com/forum/showthread.php?t=56823
The query: use ORDER BY id DESC, the first result will be the most recent addition to your database PROVIDING your id field is auto-increment
with the above quote, i would called it like this from the paper table and yes to your question, the id feild is auto-increment.
$paperquery = mysql_query("SELECT id FROM paper ORDER BY id DESC");
$paper = mysql_fetch_object($paperquery);
so would i call it as normal using $paper->id ?
Cheers.
Dan