iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-14-2008, 01:17 PM
WebProWorld Member
 
Join Date: Aug 2003
Location: Jersey City, NJ
Posts: 74
jazzmatazz2005 RepRank 0
Default Adding multiple entries to my database at 1 time

i have put together a few pages on my local machine.
the first page allows me to to add images to a certain name that's already in the DB
the code looks likes this:

<form enctype='multipart/form-data' action='process.php' method='post'>
<table width='78%' border=0>
<tr><td> name</td>
<td><select name="name" id="name">
<?php
do {
?>
<option value="<?php echo $row_Recordset1['fname']?>"><?php echo $row_Recordset1['fname']?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
</select>
The last profle created is selected by default </td>
</tr>
<tr><td> smimage</td>
<td>
<input name='smimage' type='file' size="125"></td></tr>
<tr><td> lgimage</td>
<td>
<input name='lgimage' type='file' size="125"></td></tr>
</table>
<input type='submit' value='Submit Form'> <input type=reset value='Clear Form'></form>
<br><br><br>

The process page looks like this:

<?php
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','name');
$smimage=$HTTP_POST_FILES['smimage'];
$lgimage=$HTTP_POST_FILES['lgimage'];
if($HTTP_POST_FILES['smimage']['tmp_name']==""){ }
else if(!is_uploaded_file($HTTP_POST_FILES['smimage']['tmp_name'])){
$error.="<li>The file, ".$HTTP_POST_FILES['smimage']['name'].", was not uploaded!";
$errors=1;
}
if($HTTP_POST_FILES['lgimage']['tmp_name']==""){ }
else if(!is_uploaded_file($HTTP_POST_FILES['lgimage']['tmp_name'])){
$error.="<li>The file, ".$HTTP_POST_FILES['lgimage']['name'].", was not uploaded!";
$errors=1;
}
if($errors==1) echo $error;
else{
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['smimage']['name'];
$image_list[1] = $image_part;
copy($HTTP_POST_FILES['smimage']['tmp_name'], "../media/img/".$image_part);
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['lgimage']['name'];
$image_list[2] = $image_part;
copy($HTTP_POST_FILES['lgimage']['tmp_name'], "../media/img/".$image_part);
$where_form_is="".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."media/img/".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF) ,"/"));
$message="name: ".$name."
smimage: ".$where_form_is."files/".$image_list[1]."
lgimage: ".$where_form_is."files/".$image_list[2]."
";
$link = mysql_connect("localhost","root","");
mysql_select_db("unrated1",$link);
$query="insert into unrated2 (name,smimage,lgimage) values ('".$name."','".$where_form_is."".$image_list[1]."','".$where_form_is."".$image_list[2]."')";
mysql_query($query);
?>


<!-- This is the content of the Thank you page, be careful while changing it -->

<h2>Thank you!</h2>

<table width=50%>
<tr><td>name: </td><td> <?php echo $name; ?> </td></tr>
<tr><td>smimage: </td><td> <?php echo $smimage; ?> </td></tr>
<tr><td>lgimage: </td><td> <?php echo $lgimage; ?> </td></tr>
</table><br /><br />
<a href="form1.php">insert another</a>
<br /><br />
<a href="../1/form1.html">Create Profile </a>
<!-- Do not change anything below this line -->

<?php
}
?>

This is a sample of what this code is putting in the database
1295 Nadia media/img/10_13_37_TN_nadia_dawn_20.jpg media/img/10_13_37_nadia_dawn_20.jpg 2008-02-14 10:13:37
1296 Nadia media/img/10_13_51_TN_nadia_dawn_21.jpg media/img/10_13_51_nadia_dawn_21.jpg 2008-02-14 10:13:51
1297 Nadia media/img/10_14_04_TN_nadia_dawn_22.jpg media/img/10_14_04_nadia_dawn_22.jpg 2008-02-14 10:14:04

Every row has a the primary key, name, smimage, lgimage,time stamp.

The problem some names have lots of pictures that need to go with them and the way the code is currently i have to do it one at a time and that to slow when i have about 5000 images that need to go in.

How can i make this work so i can put in up to 20 entries (rows) at a time and not change the database structure.
__________________
It's better to do business with me than against me!

Last edited by jazzmatazz2005; 02-14-2008 at 01:25 PM.
Reply With Quote
  #2 (permalink)  
Old 05-22-2008, 08:48 PM
WebProWorld Member
 
Join Date: Aug 2003
Location: Jersey City, NJ
Posts: 74
jazzmatazz2005 RepRank 0
Lightbulb Re: Adding multiple entries to my database at 1 time

anybody.........
__________________
It's better to do business with me than against me!
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding time lapse webcam RCarpadus Graphics & Design Discussion Forum 2 12-06-2005 07:35 PM
Using Flash for the First Time - Part 2: Adding Symbols, An WPW_Feedbot Graphics & Design Discussion Forum 0 05-02-2005 03:06 PM
Logging New Database entries in Access mab9981 Database Discussion Forum 2 03-12-2005 12:01 PM
Multiple Vulnerabilities in Oracle Database Server WPW_Feedbot IT Discussion Forum 0 01-18-2005 07:30 PM
Generating multiple static pages from a database Sergio Simarro Search Engine Optimization Forum 2 05-17-2004 05:43 AM


All times are GMT -4. The time now is 05:24 PM.



Search Engine Optimization by vBSEO 3.3.0