View Full Version : Php Sql Display
05-05-2006, 12:36 PM
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
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:
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
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.