Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-05-2006, 11:36 AM   PM User | #1
ausnrl
Regular Coder

 
Join Date: Feb 2005
Posts: 102
Thanks: 3
Thanked 0 Times in 0 Posts
ausnrl is an unknown quantity at this point
Php Sql Display

Hey guys

Recently i have been coding a php code which auto submits to a database.

Can anyone supply me with a code of

Showing the lastest article with a read more option

Showing the latest ten with read more

Showing all with read more
ausnrl is offline   Reply With Quote
Old 05-05-2006, 11:43 AM   PM User | #2
mio
New Coder

 
Join Date: May 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
mio is an unknown quantity at this point
can you give me 1000K bucks for...free ?
just kidding ausnrl but coding is purely not copying/pasting sample code form here and there.

You have the main guideline of your project:
database => search sql queries how to.
display result with php => search php/sql how to.

you can do it yourself. So do it
mio is offline   Reply With Quote
Old 05-05-2006, 02:18 PM   PM User | #3
degsy
Senior Coder

 
Join Date: Nov 2002
Location: North-East, UK
Posts: 1,265
Thanks: 0
Thanked 0 Times in 0 Posts
degsy is on a distinguished road
It's hasn't got much to do with PHP code. The SQL query will do most of the work for you.

Use LIMIT to determine the number of records.
Use SUBSTRING or SUBSTRING_INDEX to trim your content.

PHP Code:
select *, if(length(content)>100,concat((reverse(substring(reverse(substring(content,1,100)),instr(reverse(substring(content,1,100)),' '),length(content)))),'...'),content) as snippet from article 
http://forums.devshed.com/php-develo...1-2.html?pp=15
degsy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:02 AM.


Advertisement
Log in to turn off these ads.