Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6926441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:55:07+00:00 2026-05-27T10:55:07+00:00

I have initialized a variable called lets say a = 0; when the user

  • 0

I have initialized a variable called lets say a = 0;
when the user clicks the button for next picture, a is incremented by one and there for i need to call the picture with the id of the value of ‘a’.

Would the best way to do this be to run a query every time the button is clicked, or rather store all the images in an array and call the ‘a-th’ value of the array on click?

Please Help, Much Appreciated, Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:55:08+00:00Added an answer on May 27, 2026 at 10:55 am

    There’s cons to both situations.

    1. if you load all images and save to array that 1st picture might take time to load and the user might no even be interested in going to the rest.

    2. if you load as they click next then it might take a while for each image loads.

    when uploading images

        $filename = "";
    
                if(!empty($_FILES["file"]))
                {
                    if ((($_FILES["file"]["type"] == "image/gif")
                        || ($_FILES["file"]["type"] == "image/jpeg")
                        || ($_FILES["file"]["type"] == "image/pjpeg")))
                    {
                        if ($_FILES["file"]["error"] > 0)
                            echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
                        else
                        {
                            $filename = $_FILES["file"]["name"];
                            if (file_exists("../img/noticias/" . $_FILES["file"]["name"]))
                                echo "Image " .$_FILES["file"]["name"] . " exists.";
                            else
                            {
                                move_uploaded_file($_FILES["file"]["tmp_name"],
                                "your server path" .  $_FILES["file"]["name"]);
    
                            }
                        }
                    }
                }
    

    then save $filename to your table
    To view them in gallery

        while($row = $db->fetch_array($query)){  
            echo '<img src="path/to/images/' . $row['filename'] . '" width="219" height="117" />';
    
        }  
    

    and using something like Lightbox you can use jquery to make a popup to view larger or add a hyperlink to each image so they can view in a seperate page the full size image.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a global variable I called Y_VAL which is initialized to a value
Error % javac StringTest.java StringTest.java:4: variable errorSoon might not have been initialized errorSoon[0] =
$ javac InitInt.java InitInt.java:7: variable right might not have been initialized InitInt(){} ^ 1
WorkAround: I have declared a class level Public static variable and initialized with a
I have a NSDate *date1 in class1 implementation file(I initialized it as Global variable).
Let's say I have a simple class called WebsterDictionary that has a function that
Let's say I have a class Foo with some primitive instance variables. I initialize
I have always initialized my strings to NULL, with the thinking that NULL means
I have a UINavigationController containing an UIViewController initialized with a UIView. The UINavigationController also
I currently have 2 BufferedReader s initialized on the same text file. When I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.