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 8478901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:52:33+00:00 2026-06-10T18:52:33+00:00

With what i have done so far, I can upload an image to a

  • 0

With what i have done so far, I can upload an image to a folder and save the name in the database. What i am trying to do is to be able to view each image in a browser with the corresponding name besides or under it. But what i have is the wrong image assigned a wrong name. The first image in my browser is assigned the next two names in the records in the database. What am i doing wrong? Please I need help.

Here are my codes:

ADD Page:-

    <table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="100" align="center" bgcolor="#CC0000" class="header_title">Facilitators Panel
          <table width="600" height="30" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="448" class="header_title" height="20"></td>
              <td width="92" class="text2"><a href="cpanel.php?user=<?php echo $row_rsadmin['aID']; ?>">Control Panel</a></td>
              <td width="60" class="text2">Logout</td>
            </tr>
          </table></td>
      </tr>
      <tr>
        <td height="300" valign="top" bgcolor="#666666" class="text2"><table width="640" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td class="text2"><a href="adfacilitators.php?user=<?php echo $row_rsadmin['aID']; ?>">Back</a></td>
          </tr>
          <tr>
            <td class="text2">&nbsp;</td>
          </tr>
        </table>
          <table width="640" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="640" height="40" colspan="4" align="center"><form action="fac.php" method="post" enctype="multipart/form-data" name="fac" id="fac">
      <table width="580" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td height="1" align="right">&nbsp;</td>
        </tr>
        <tr>
          <td width="132" align="right" class="text3">Name:</td>
          <td width="10" rowspan="4">&nbsp;</td>
          <td colspan="2"><label>
            <input name="name" type="text" class="textbox" id="name" />
          </label></td>
        </tr>
        <tr>
          <td height="45" align="right"><p class="text3">Photo:</p></td>
          <td width="272" height="45"><input type="hidden" name="MAX_FILE_SIZE" value="256000" />
            <input name="photo" type="file" id="photo" size="26" /></td>
          <td width="166">&nbsp;</td>
        </tr>
        <tr>
          <td height="1" align="right">&nbsp;</td>
        </tr>
        <tr>
          <td height="40" align="right">&nbsp;</td>
          <td colspan="2" valign="top"><label>
            <input name="button" type="submit" class="readmore" id="button" value="Submit" />
          </label>
            <input name="button2" type="reset" class="readmore" id="button2" value="Reset" /></td>
        </tr>
      </table>
    </form></td>
          </tr>
          <tr>
            <td height="10" colspan="4" align="center"></td>
          </tr>
          </table></p></td></tr>
    </table>

Processing Page:-

    <?php require("../Connections/connMain.php"); ?>
    <?php

                // validation... since this is an image upload script we should run a check   
                // to make sure the uploaded file is in fact an image. Here is a simple check: 
                // getimagesize() returns false if the file tested is not an image. 
                if ($image = @getimagesize($_FILES['photo']['tmp_name'])&& ($_FILES["photo"]["size"]<= 2560000))
                {}
                else
                {
                    header("Location:error1.php");

                exit;
                }


       //This gets all the other information from the form 
      $name = htmlspecialchars($_POST['name']);
      $pix= ($_FILES['photo']['name']);
      $tmpName = $_FILES['photo']['tmp_name']; 


     //Writes the information to the database 
     mysql_query("INSERT INTO facilitators (photo, name) VALUES ('$pix', '$name')"); 


     //This is the directory where images will be saved 
     // Make sure the file was sent without errors
     //if($_FILES['photo']['error'] == 0) {
     $target = "../facilitators/";

     $target = $target  . basename( $_FILES['photo']['name']); 


     //Writes the photo to the server 
     if(move_uploaded_file($tmpName, $target)) 
     { 

     header("Location:adfacilitators.php");

     }
     else { 

     header("Location:error2.php");

     }
    ?>

OutPut Page:

<div id="wrapper2">
    <div id="headercont"><?php require_once('header.html'); ?></div>
    <div id="bannercont"><?php require_once('banner.html'); ?></div>
    <div id="mainbody">
      <div id="sidelink"><?php require_once('sidelink.html'); ?></div>
        <div id="mainbodyr">
          <div class="clear_4"></div>
          <div id="subheadertext">Facilitators</div>
          <div class="clear_4"></div>
          <div id="mainbodycontentcont">
            <?php do { ?>
            <table width="520" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="150"><div id="mainbodypiccont">
                  <? $info = mysql_fetch_array( $rsFacilitator ); echo "<img src=http://localhost/youngatart/facilitators/".$info['photo'] ." width='150'>" ?>
                </div></td>
                <td width="370"><div id="mainbodytextcont">
                  <div id="text1"><?php echo $row_rsFacilitator['name']; ?></div>
                </div></td>
              </tr>
              <tr>
                <td height="20" colspan="2"></td>
              </tr>
            </table>
              <?php } while ($row_rsFacilitator = mysql_fetch_assoc($rsFacilitator)); ?>
          </div>
        </div>
        <div class="clear_5"></div>
    </div>
    </div>
</body>
  • 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-06-10T18:52:35+00:00Added an answer on June 10, 2026 at 6:52 pm

    Check this, I have changed your code a bit,

    <div id="mainbodycontentcont">
                <?php while ($row_rsFacilitator = mysql_fetch_assoc($rsFacilitator) { ?>
                <table width="520" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="150"><div id="mainbodypiccont">
                      <? echo "<img src=http://localhost/youngatart/facilitators/".$row_rsFacilitator['photo'] ." width='150'>" ?>
                    </div></td>
                    <td width="370"><div id="mainbodytextcont">
                      <div id="text1"><?php echo $row_rsFacilitator['name']; ?></div>
                    </div></td>
                  </tr>
                  <tr>
                    <td height="20" colspan="2"></td>
                  </tr>
                </table>
                  <?php }?>
              </div>
    

    EDIT
    i did not exactly understand your question but if you want to edit your data from image click just give <a> tag to image.

    <div id="mainbodycontentcont">
                    <?php while ($row_rsFacilitator = mysql_fetch_assoc($rsFacilitator)) { ?>
                    <table width="520" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="150"><div id="mainbodypiccont">
                          <? echo "<a href='yourfilename.php?imageid=1'><img src=http://localhost/youngatart/facilitators/".$row_rsFacilitator['photo'] ." width='150'></a>" ?>
                        </div></td>
                        <td width="370"><div id="mainbodytextcont">
                          <div id="text1"><a href='yourfilename.php?imageid=1'><?php echo $row_rsFacilitator['name']; ?></a></div>
                        </div></td>
                      </tr>
                      <tr>
                        <td height="20" colspan="2"></td>
                      </tr>
                    </table>
                      <?php }?>
                  </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have not done any animation stuff with iphone development so far. Can anybody
What i have done so far is public class GalleryView extends Activity { public
I have done one program that allow user can listen to the music via
All my research so far suggests this can't be done, but I'm hoping someone
I have done far more C++ programming than plain old C programming. One thing
I have been given some file name which can be like <filename>YYYYMMDD<fileextension> some valid
What I have done so far, using PyQt classes: all_Addresses = QNetworkInterface.allAddresses() #list-of-QHostAddress for
What I have done so far I have created a website using CGI::Application and
I am struggling with this problem from yesterday. What I have done so far?
i'm trying to create details for each div that i have in a list.

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.