473,385 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Encountered ERROR

ddtpmyra
333 100+
Anybody have ever encounter the error below and what's the meaing of it?This happens when I upload a file using the PHP on my SQL.

"Notice: Undefined index: approval1 in Vol3:/DM/add_file2.php on line 150"
Sep 26 '08 #1
7 1609
Atli
5,058 Expert 4TB
This isn't technically and error. It's a notice.
The message really says it all.

Your code is trying to read an undefined array index on line 150 of your code, called "approval1".

I'm guessing, since this has something to do with file uploads, that this index is being read from the $_POST super-global, but the field in question has either not been posted, or was left out in your <form>.

What does line 150 of your code look like?
Sep 26 '08 #2
ddtpmyra
333 100+
It pointed to my sql query

Expand|Select|Wrap|Line Numbers
  1.         $query = "
  2.             INSERT INTO fileStorage (
  3.                 FileName, FileMime, FileSize, FileData, Created, Description,Author, Requestor, DeadLineFeedback, category
  4.             )
  5.             VALUES (
  6.                 '{$name}', '{$mime}', {$size}, '{$data}', NOW(), '{$description}', UPPER('{$author}'), UPPER('{$requestor}'), '{$DateInput}','{$category}'
  7.             )";
Sep 27 '08 #3
Atli
5,058 Expert 4TB
Are you sure?
The notice is complaining about an index named "approval1".

Where is that being used?
Sep 27 '08 #4
ddtpmyra
333 100+
Hi Atli,

Just a follow up question on your code was posted on 'How to' section, how can I do multiple upload this time?

thanks,
DM
Dec 2 '08 #5
Atli
5,058 Expert 4TB
You upload multiple files just like you upload a single file, you just use more <input> fields.

For example, using this form:
Expand|Select|Wrap|Line Numbers
  1. <form action="process.php" method="post" enctype="multipart/form-data">
  2.   <input type="file" name="file1" /><br />
  3.   <input type="file" name="file2" /><br />
  4.   <input type="submit" />
  5. </form>
  6.  
The two files the would be uploaded could be found in the $_FILES array in your proccess.php page:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $_FILES['file1']; // The first file would be here
  3. $_FILES['file2']; // The second would be here.
  4. ?>
  5.  
Is that what you are looking for?
Dec 3 '08 #6
ddtpmyra
333 100+
I did this first adding of couse the additional input form for th user to browse, then I tried putting it on my variables like below but didn't work

:(

Expand|Select|Wrap|Line Numbers
  1.  
  2.  $name1 = mysql_real_escape_string($_FILES['file1']['name'], $dbLink);
  3.  $mime1 = mysql_real_escape_string($_FILES['file1]['type'], $dbLink);
  4.  $size1 = $_FILES[file1']['size'];
  5.  $data1 = mysql_real_escape_string(file_get_contents($_FILES  ['file1']
  6.  
  7.  $name2 = mysql_real_escape_string($_FILES['file2']['name'], $dbLink);
  8.  $mime2 = mysql_real_escape_string($_FILES['file2]['type'], $dbLink);
  9.  $size2 = $_FILES['file2']['size'];
  10.  $data2 = mysql_real_escape_string(file_get_contents($_FILES  ['file2']
  11. ['tmp_name']), $dbLink);
and the query

Expand|Select|Wrap|Line Numbers
  1. $query = "INSERT INTO fileStorage (FileName1,FileMime1,FileSize1,FileData1,
  2.     FileName2,FileMime2,FileSize2,FileData2)
  3.             VALUES     (
  4.                     '{$name1}','{$mime1}',{$size1},'{$data1}',
  5.                     '{$name2}','{$mime2}',{$size2},'{$data2}'
  6.                                 )";
  7.  
Dec 3 '08 #7
Atli
5,058 Expert 4TB
That's not a very good way to do this.
Your query would essentially require you to duplicate each column of the table for each additional file, which would cause all sorts of problems.

What you should be doing is add a new row for each file, not new columns to each row for each new file.

A multiple insert query should look like:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO myTable (col1, col2, colN) VALUES
  2. ('value11', 'value12', 'value1N'),
  3. ('value21', 'value22', 'value2N'),
  4. ('valueN1', 'valueN2', 'valueNN');
  5.  
Which you could use to add as many new rows as you like to your table without having to change the structure of it.
Dec 4 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Durairaj Avasi | last post by:
#!/usr/bin/perl -w use Net::LDAP; use Net::LDAP::Util qw(ldap_error_name ldap_error_text); my $ldap = Net::LDAP->new('xy.webdurai.net', port=> 389) or die "$@"; $ldap->debug(15); my @args = (...
5
by: DraguVaso | last post by:
Hi, I tried to deploy an application written in VB.NET 2005, with the Release Candidate. Everything works fine on my pc which has the Visual Studio installed, but when I install the .NET...
13
by: M O J O | last post by:
Often when I run my aspnet 2.0 vb application, I get this exception.... "Microsoft (R) Visual Basic Compiler has encountered a problem and needs to close. We are sorry for the inconvenience." ...
2
by: mpatel6 | last post by:
I had this error in alert log and my instance was down, anybody can help me? Errors in file /u01/app/oracle/admin/sotstest/bdump/sotstest_p004_626740.trc: ORA-07445: exception encountered: core...
2
by: AB | last post by:
Hi to all, I have a problem about a importation of a file *.csv with SQL Server, through a bulk insert, called in a store procedure that a c# sw calls. This is the description of the error:...
3
by: AB | last post by:
Hi to all, I have a problem about a importation of a file *.csv with SQL Server, through a bulk insert, called in a store procedure that a c# sw calls. This is the description of the error:...
4
by: muzu1232004 | last post by:
i got the following Error message occurred while exporting: EXP-00008: ORACLE error 1455 encountered ORA-01455: converting column overflows integer datatype EXP-00056: ORACLE error 1403...
5
by: lunie | last post by:
Hello, anyone please help me. I have an oralce database and using forms6i to upload the data in SAP 560 system. But i always encountered this message. Just wonder because i dont encountered any error...
4
by: =?Utf-8?B?Um9iZXJ0IFN0eW1h?= | last post by:
Hello All, I am new to these forums and reasonably new to Visual Basic.net. I have been converting a couple of visual basic 6 programs to VB.NET. The programs began failing under windows Vista, so...
39
by: Martin | last post by:
I have an intranet-only site running in Windows XPPro, IIS 5.1, PHP 5.2.5. I have not used or changed this site for several months - the last time I worked with it, all was well. When I tried it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.