Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Thanked 0 Times in 0 Posts

    how to make "pic of the day" script?

    Hello...can someone help me about "pic of the day" script ?
    I want to put the script in the index page..that is also clickable to a larger image. Also it would be nice if there is an upload script so anyone can upload their pics also...any help will be very valuable...thanks in advance


  • #2
    New Coder
    Join Date
    Jul 2002
    Regina, Saskatchewan, Canada
    Thanked 0 Times in 0 Posts
    To upload, it is a simple method of using copy(). The first attribute is the file uploaded, and the second is where you want it to go. BUT, when you specify where you want it to go, you MUST place "_name" after the variable of the file:

    copy($File_Submitted, "pics/$File_Submitted_name");

    Now, for the Pic-Of-The-Day, I would suggest MySQL. If you set up a table called "pidofday," you could make two columns - one named "date," one named "image."

    Make enteries like:

    date: July 31, 2002
    image: image1.gif

    date: August 1, 2002
    image: other.gif

    Then, put this script on your page:

    mysql_connect("localhost", "user","pass");

    $today = date("F j, Y");

    if ($query = mysql_query("select * from picofday where date = '$today'")) {
    $both = mysql_fetch_array($query);
    echo "<img src='" . $both["image"] . "' />";
    } else {
    echo "Error in finding image.";
    Jared Brandt


    Posting Permissions

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