Jump to content


How can i select the newest info only?


4 replies to this topic

#1 1288

    Young Padawan

  • Members
  • Pip
  • 15 posts

Posted 01 October 2005 - 03:37 AM

Hello I wanted to know if any one can help me with my problem what I’m trying to code ads thing on my sBLOG system

What I need it to get a code that will allow me to select only the first posted blog on the page as in the top one and then have it put an echo of the ad I want inside the echo.

sBLOG: http://servous.se
my site if u want to see how it looks/works: http://half-alive.com

Sorry if I didn’t emplain it well.

Well basically I just was something that will only add info to the newest post.

#2 Stu

    Retired P2L Staff

  • Publishing Betazoids
  • PipPipPipPip
  • 1,761 posts
  • Gender:Male

Posted 01 October 2005 - 11:40 AM

not sure but there might be something in a config file which will let you select how many posts to display on the first page?

btw,

Quote

PIXEL4LIFE

Tutorials Database

its pixel2life B)

#3 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 01 October 2005 - 12:26 PM

Add an auto-incrementing column to the table that contains the posts. Then select the id's something like this:
mysql_query("SELECT * FROM `table` ORDER BY id DESC");
Also, if you don't know how to do what i just said, then you probably don't know enough about PHP to code a BLOG right now, and i'd suggest some smaller projects first.

#4 1288

    Young Padawan

  • Members
  • Pip
  • 15 posts

Posted 01 October 2005 - 08:21 PM

thats Stu but i have like looked threw all the files and i cant find anything that can do that. :unsure:

and also soz rc69 but i dont really get how that code would work to make it have like only a google ad under the newest posts. :)

#5 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 01 October 2005 - 08:35 PM

Sorry, but the topic title, and what you said in your post really conflicted with each other... Leaving me to say this. I no longer have any clue how to help you, or exactly what you need help with.

I guess something you could do, would be to modify the above code a little, and throw your google ad JavaScript into one file, and do this:
$sql = mysql_query("SELECT * FROM `table` ORDER BY id DESC LIMIT 1");
$r = mysql_fetch_array($sql);
echo $r['message'].'<br>'; // This would be where you echo the most recent entry with what ever html you want...
include('google_file.php'); // This is where the google ad is included.  google_file.php is the name of the file you put the JS into (the name can be changed).
Good Luck.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users