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" 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?
It pointed to my sql query - $query = "
-
INSERT INTO fileStorage (
-
FileName, FileMime, FileSize, FileData, Created, Description,Author, Requestor, DeadLineFeedback, category
-
)
-
VALUES (
-
'{$name}', '{$mime}', {$size}, '{$data}', NOW(), '{$description}', UPPER('{$author}'), UPPER('{$requestor}'), '{$DateInput}','{$category}'
-
)";
Atli 5,058
Expert 4TB
Are you sure?
The notice is complaining about an index named "approval1".
Where is that being used?
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
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: -
<form action="process.php" method="post" enctype="multipart/form-data">
-
<input type="file" name="file1" /><br />
-
<input type="file" name="file2" /><br />
-
<input type="submit" />
-
</form>
-
The two files the would be uploaded could be found in the $_FILES array in your proccess.php page: -
<?php
-
$_FILES['file1']; // The first file would be here
-
$_FILES['file2']; // The second would be here.
-
?>
-
Is that what you are looking for?
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
:( -
-
$name1 = mysql_real_escape_string($_FILES['file1']['name'], $dbLink);
-
$mime1 = mysql_real_escape_string($_FILES['file1]['type'], $dbLink);
-
$size1 = $_FILES[file1']['size'];
-
$data1 = mysql_real_escape_string(file_get_contents($_FILES ['file1']
-
-
$name2 = mysql_real_escape_string($_FILES['file2']['name'], $dbLink);
-
$mime2 = mysql_real_escape_string($_FILES['file2]['type'], $dbLink);
-
$size2 = $_FILES['file2']['size'];
-
$data2 = mysql_real_escape_string(file_get_contents($_FILES ['file2']
-
['tmp_name']), $dbLink);
and the query -
$query = "INSERT INTO fileStorage (FileName1,FileMime1,FileSize1,FileData1,
-
FileName2,FileMime2,FileSize2,FileData2)
-
VALUES (
-
'{$name1}','{$mime1}',{$size1},'{$data1}',
-
'{$name2}','{$mime2}',{$size2},'{$data2}'
-
)";
-
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: -
INSERT INTO myTable (col1, col2, colN) VALUES
-
('value11', 'value12', 'value1N'),
-
('value21', 'value22', 'value2N'),
-
('valueN1', 'valueN2', 'valueNN');
-
Which you could use to add as many new rows as you like to your table without having to change the structure of it.
Sign in to post your reply or Sign up for a free account.
Similar topics
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 = (...
|
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...
|
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."
...
|
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...
|
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:...
|
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:...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
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...
| |