Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorLucaFL
    • CommentTimeOct 1st 2007
     
    Hi.
    I want to show the last picture on the main page of my homepage.
    how can i do this?
    Thanks for help
  1.  
    on your home page connect to the database you're using with the plogger user/pass and run this query:

    select path from plogger_pictures order by id desc limit 1

    then save the query into a variable and create the image tag like this

    <img src="http://www.yourdomain.com/ploggerdir/images/$path">

    might have to do ' . $path . '

    and of course use quotes accordingly...
    • CommentAuthorLucaFL
    • CommentTimeOct 2nd 2007
     
    Thank you for the fast feedback.
    unfortunately i'm a beginner in php and sql so i need a little help to realize this
    the beginning of the query is:
    $query = "SELECT
    `path`,
    `id`
    FROM `plogger_pictures`

    is that correct? now to the part order by id desc limit 1. what to you mean with that? Must i increment a value to come to the last id? And if yes how did i do this?
    Thanks for help and sorry for my poor english :)
  2.  
    ok you really only need the path from the database so you would just do:

    select path from plogger_pictures

    then you want to order all the pictures by id so they are in order from first to last

    order by id

    then you want to reverse the order

    desc (for descending order, last to first)

    then you only wanted the last picture so limit the results to one line

    limit 1

    if you run this query by hand on your mysql database you can check the result... but this query should return the path for the picture with the highest id (highest id should be the newest picture)
    • CommentAuthorLucaFL
    • CommentTimeOct 4th 2007
     
    Thank you!