UPDATE: MY COMMENTS POST BUT NOTHING ELSE? I have a form that collects firstname, lastname, email, attachment(file), and comments. I can query from my database, but when i submit data the fields are BLANK? What is going on? Below is sql on export.

Table structure for table `clientlist`
--

CREATE TABLE `clientlist` (
`id` int(5) NOT NULL auto_increment,
`firstName` varchar(20) NOT NULL default '',
`lastName` varchar(30) NOT NULL default '',
`email` varchar(40) NOT NULL default '',
`attachment` longblob,
`comments` mediumblob NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=6 ;

--
-- Dumping data for table `clientlist`
--

INSERT INTO `clientlist` VALUES (1, '\0', '\0', '\0', '', 0x21);
INSERT INTO `clientlist` VALUES (2, '', '', '', '', 0x796f7520617265207468652062657374);
INSERT INTO `clientlist` VALUES (3, '', '', '', '', 0x596f75206172652066616e746173746963);
INSERT INTO `clientlist` VALUES (4, '', '', '', '', '');
INSERT INTO `clientlist` VALUES (5, '', '', '', '', 0x6b7364666a6b647366);

Member Avatar for GreenDay2001

the correct syntax is somewhat like this

insert into table-name(column-names) values (values)

for example in a table with columns FirstName LastName EMail AEmail Pass the statement would be somthing like this

insert into users (FirstName,LastName,EMail,AEmail,Pass) values
('Vishesh',
'Yadav',
'vishesh91@msn.com',
'coolvish91@yahoo.com',
'vishesh');

I'v got that now I am trying to find the code to upload a file that is in my form directly to myspl database. Suggestions?

Member Avatar for GreenDay2001

I am trying to find the code to upload a file that is in my form directly to myspl database. Suggestions?

To do that just make a variable which holds the URL of the file and then use insert statement to do that. The expression to makr that statement depends upon the language on which you are working. e.g. if I do it in ASP, where FileURL is the URL of the file:

SQLCommand = "insert into myTable(FilePath) values" & "'" & FileURL & "');"

Using PHP Here is the error I just got.

Upon submission, it says that the attachment is an array? What am I doing wrong?

MY CODE:

$firstName = "$_POST[firstName]";//firstname that the person gave on the form
$lastName = "$_POST[lastName]"; //lastname that the person gave on the form
$email = "$_POST[email]";//Email that person gave on the form
$fileupload = "$_FILES[fileupload]";
$comments = "$_POST[comments]";//comments that person gave on the form

mysql_connect($host,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$sqlquery = "INSERT INTO memberlist VALUES('$id','$firstName','$lastName','$email','$fileupload','$comments')";
$results = mysql_query($sqlquery);
mysql_close();

My clients will be uploading files, so the file is unknow.

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.