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

  • SEARCH
  • Home
  • 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 6363737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:04:29+00:00 2026-05-25T00:04:29+00:00

I actually have a few questions here: My end goal is to write a

  • 0

I actually have a few questions here: My end goal is to write a script that will automatically display all the images that i have saved inside my database(If i add new images to my database(image URLs), each time i refresh the page i would like those “new” images to be instantly displayed as well).

  1. What is the proper way to save an image URL inside MySQL? Currently i set my input type to VARCHAR; is that okay for image URLs?

  2. Also, at the moment i’m working with WAMP server just to test how the site is working; so i put an image inside the www folder(within the same folder as my php script) and inside the database table i simply put the URL as follows: image.png
    is this the correct way to enter an image URL inside my database?

  3. What is the best way to display these images in a sequence? The following code is what i have so far:(the image widths will take up about 70% of the page so the images will not be next to each other; they will be in a column form.)

    <?php
       $db_host="host";
       $db_user="user";
       $db_pass="pass";
       $db_name="name";
       $db_table="table";
    
       mysql_connect($db_host, $db_user, $db_pass) or die(mysql_error());
       mysql_select_db($db_name) or die(mysql_error());
    
       $query = mysql_query("SELECT * FROM tablename");
       $result = mysql_query($query);
       $num = mysql_num_rows($result);
    
       for($count = 0; $count < $num; $count++)
       {
           //output the rows one by one(the actual images, not the URLs)
           mysql_fetch_row($result);
           echo("<br/>");
       }
    ?>
    

    I don’t know if i should be using mysql_fetch_row in there..

  4. I want my images to have some space in between; i was thinking the best way to accomplish that would be to add a “br” tag at the end of my loop so that every time a new image is displayed, a line break will be added to the end of the page.. Is that the best way to do it?

Thanks a bunch in advance!

  • 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-25T00:04:30+00:00Added an answer on May 25, 2026 at 12:04 am

    To your first question, yes. To your second, also yes, if all your images are stored in the same directory. Mostly it’s a matter of preference though.

    Your for loop should look like this:

      for($count = 0; $count < $num; $count++) {
           $row = mysql_fetch_assoc($result);
           echo "<img src='". htmlspecialchars($row["image"]) ."' alt='image' />";
       }
    

    br tags would probably be a bad idea. Set the images’ display property to block in your CSS file. There are plenty of CSS manuals online.

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

Sidebar

Related Questions

I have seen a few questions that are like mine, but none that actually
I actually have two questions regarding exception/error handling in the iPhone app that I
I actually have some questions (real childish). 1) If I know that a website
So I have been through most of the questions here. Also quite a few
I've seen a few similar questions on SO but nothing that seems to actually
First of all I have seen that there are many questions about unrecognized selector
I started to use Borland's Turbo C++ a few days ago. I actually have
I actually have right now two questions: 1) What font faces are preferred for
I actually have 2 queries: How do I display the data of a variable
I actually have two questions, the on in the title being the main one.

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.