...

View Full Version : Php Sql Display



ausnrl
05-05-2006, 12:36 PM
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

mio
05-05-2006, 12:43 PM
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 :thumbsup:

degsy
05-05-2006, 03:18 PM
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.



select *, if(length(content)>100,concat((reverse(substring(reverse(substring(content,1,100)),instr(reverse(substring(content,1,10 0)),' '),length(content)))),'...'),content) as snippet from article


http://forums.devshed.com/php-development-5/how-do-you-limit-things-to-a-certain-length-23711-2.html?pp=15



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum