Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Php Sql Display

  1. #1
    Regular Coder
    Join Date
    Feb 2005
    Posts
    102
    Thanks
    3
    Thanked 0 Times in 0 Posts

    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

  • #2
    mio
    mio is offline
    New Coder
    Join Date
    May 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •