multiple upload function php/mysql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
blade_922
Forum Contributor
Posts: 132
Joined: Wed Jul 12, 2006 4:57 pm

multiple upload function php/mysql

Post by blade_922 »

Hi there,

I've run into a wee bit of trouble with coding.

This is what im trying to achieve:

I have a mysql table of 2000 records or so. Now the fields that will be used in this script are 'id' field and 'name' field and 'box' field.

The name field is the name of a game and the box field is where the image url is stored when the image is uploaded.

Currently all the records have the game name and only a few hundred have images already.


Table looks like this so far with about 2000 records

| id | game name | box(url) |
1 aaaaaaaaaaaa
2 aaaaaaaaaaaa
3 aaaaaaaaaaaa
4 aaaaaaaaaaaa images/abc.jpg
5 aaaaaaaaaaaa
6 aaaaaaaaaaaa


On each row of the table in the box field i want it to show if there is an image already uploaded and also the browse button above to upload for those without an image and a submit button for each row so i can upload them one at a time on the same page.

And if it uploads correctly it will show the url in the field below it. There is only one image for each row.

like this

| id | game name | box(url) |
1 aaaaaaaaaaaa [.......................] Browse Submit
[if image exists display url here]
2 aaaaaaaaaaaa [.......................] Browse Submit
[if image exists display url here]
3 aaaaaaaaaaaa [.......................] Browse Submit
[if image exists display url here]
4 aaaaaaaaaaaa [.......................] Browse Submit
[if image exists display url here]
5 aaaaaaaaaaaa [.......................] Browse Submit
[if image exists display url here]



I have this so far

Code: Select all

<?php
 
include 'config.php';
include 'opendb.php';
 
 
$result = mysql_query("SELECT * FROM ccms_gameindex ORDER BY id ASC") 
or die(mysql_error());  
 
echo "<table border='1'>";
echo "<tr> <th>Name</th> <th>id</th> <th>console</th> <th>box</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
    // Print out the contents of each row into a table
    echo "<tr><td>"; 
    echo $row['title'];
    echo "</td><td>"; 
    echo $row['id'];
    echo "</td><td>"; 
    echo $row['category'];
    echo "</td><td>"; 
    echo $row['box'];
    echo "</td></tr>"; 
} 
 
echo "</table>";
 
 
 
 
include 'closedb.php';
 
?>

I dont know how to use the multiple upload function at all. :(
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: multiple upload function php/mysql

Post by requinix »

Wait to do the uploading until the rest of the table is completed. Adding upload functionality, even for multiple files at once, is not a difficult task if the rest of the form and form submission process is already done.
Post Reply