I have one table as movie. In that i have one field as 'image' in which i want to store the images. In my mca project, I m trying to make admin panel. For this when administrater is going to add movie details, at that time i want to store the image of movies then how can i do this? and i also want to disply that images in other pages. for example: when administrator want to view data of movie table then at that time that movie image shold also be displayed.

Plz help me. as soon as possible.

Thanks in advance.. plz help me

U can create folder and do the operations seperatly.I mean move the image into thet folder, and insert the file name into the data base. you can retrive the file name from database and get the image from that folder.

Member Avatar for LastMitch

@MMadhavi

I m trying to make admin panel. For this when administrater is going to add movie details, at that time i want to store the image of movies then how can i do this? and i also want to disply that images in other pages. for example: when administrator want to view data of movie table then at that time that movie image shold also be displayed.

Can you at least post some codes so we can understand what you want to do. It's hard to understand you if you have no code to show what you want to do.

commented: To Rectify what some retard did to LastMitch +0

my code of my add movie page is as:

<?php require_once '.../dbconfig.php/'; 
//require_once('calendar/calendar/classes/tc_calendar.php');
//echo hi;
if(isset($_POST['submit']))
{
$sql=mysql_query("INSERT INTO movie(`movie_name`,`movie_id`,`actor`,`actress`,`director`,`release_year`,`description`,`image`)
VALUES('$_POST[t1]','$_POST[t2]','$_POST[t3]','$_POST[t4]','$_POST[t5]','$_POST[t6]','$_POST[t7]','$_POST[t8]')");


echo $sql." Record added Successfully";
}

//for fetch date value
//$theDate = isset($_REQUEST["date1"]) ? $_REQUEST["date1"] : "";


?>
<html>

<form action="" method="post" name="admin_movie" id="movie" onSubmit="return validation();">

            <fieldset>
    <table width="100%" cellpadding="5" cellspacing="5" align="center">
        <tr>
            <th colspan="2" valign="top" align="left" style="padding-left:263px;"><span style="border-bottom:#000000 2px solid;"></span></th>
        </tr>
        <tr><td>Enter Movie Name</td><td><input type="text" name="t1" id="name" value="" size="20" /><br></td></tr>
        <tr><td>Enter Movie_Id</td><td><input type="text" name="t2" id="id" value="" size="20" /></td></tr>
        <tr><td>Enter Actor_Name</td><td><input type="text" name="t3" id="actor" value="" size="20" /></td></tr>
        <tr><td>Enter Actress_Name</td><td><input type="text" name="t4" id="actress" value="" size="20" /></td></tr>
        <tr><td>Enter Producer_Name</td><td><input type="text" name="t5" id="producer" value="" size="20" /></td></tr>
        <tr><td>Movie Releasing Date</td><td>
                <input type="text" name="t6" id="date" value="" size="20" title="Plz enter date in yyyy-mm-dd formate"/>
                </td></tr>
        <tr><td>Description About Movie</td><td><textarea name="t7" cols="20" rows="5" id="description"></textarea></td></tr>
        <tr><td>Select Movie Image</td><td><input type="file" name="t8" value="" width="100" height="500" id="image" /></td></tr>
       <!-- <tr><td>Select Movie Image</td><td><img src="" width="150" height="100"/>-->

        <tr></tr>
        <tr><td>  <center><input type="submit" value="Submit" name="submit" /></center></td></tr>
   </table>
            </fieldset>
    </form>

</html>

My code for view_details page is as: at here i want to view the images when i run this page. my code is as:

<?php
require_once '../dbconfig.php';
$sql="SELECT * FROM movie";
$result=mysql_query($sql);
?>
<?php if (mysql_num_rows($result)==0) { ?>     Database is empty <br/> <?php } else { ?> 
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td colspan="8"><strong>List data from mysql </strong> </td>
</tr>

<tr>
<td align="left"><strong><font face="Arial, Helvetica, sans-serif">Movie_Name</strong></font></td>
<td align="left"><strong><font face="Arial, Helvetica, sans-serif">Movie_Id</strong></font></td>
<td align="left"><strong><font face="Arial, Helvetica, sans-serif">Actor</strong></font></td>
<td align="left"><strong><font face="Arial, Helvetica, sans-serif">Actress</strong></font></td>
<td align="left"><strong><font face="Arial, Helvetica, sans-serif">Director</strong></font></td>
<td align="left"><strong><font face="Arial, Helvetica, sans-serif">Release_date</strong></font></td>
<td align="left"><strong><font face="Arial, Helvetica, sans-serif">Movie Rating</strong></font></td>
<td align="left"><strong><font face="Arial, Helvetica, sans-serif">Description of movies</strong></font></td>
<td align="left"><strong><font face="Arial, Helvetica, sans-serif">Image of movies</strong></font></td>
</tr>

<?php
while($rows= mysql_fetch_array($result)){
?>

<tr>
<td><font size="3"><? echo $rows['movie_name']; ?></font></td>
<td><font size="3"><? echo $rows['movie_id']; ?></font></td>
<td><font size="3"><? echo $rows['actor']; ?></font></td>
<td><font size="3"><? echo $rows['actress']; ?></font></td>
<td><font size="3"><? echo $rows['director']; ?></font></td>
<td><font size="3"><? echo $rows['release_year']; ?></font></td>
<td><font size="3"><? echo $rows['rating']; ?></font></td>
<td width="200"><font size="2"><? echo $rows['description']; ?></font></td>
<!--<td><? //echo $rows['image']; ?></font></td>-->
<td><a href="images/<?php echo $rows['image']; ?>.jpeg"> 
 <img src="images/<?php echo $rows['image']; ?>.jpeg" alt="<?php //($rows['title']); ?>"/> 
 </a> </td>


<!-- link to update.php and send value of id -->
<td align="center"><a href="update.php?movie_id=<? echo $rows['movie_id']; ?>"><font size="3">Update</a></font></td>
<td align="center"><a href="delete.php?movie_id=<? echo $rows['movie_id']; ?>"><font size="3">Delete</a></font></td>
</tr>

<?php
}
?>

</table><?php  } ?> 
</td>
</tr>
</table>
Member Avatar for diafol

From first looks this looks totally mashed. You don't clean your input variables ($_POST) so your DB is vulnerable. There's no enctype attribute in your form tag so that it knows to upload file using $_FILES var. 't8' will not exist.

have a look at some file uploading scripts - see the php manual or Tizag's site.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.