Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hi all,
Im trying to create a form that will upload it data to a mysql database, all works except when i try to upload a picture as well and i could really use some help. when i check phpmyadmin to see the results all the results are there but in the blob field i get [BLOB - 0 Bytes]
sql:Code: Select all
CREATE TABLE `messages` (
`id` int(11) NOT NULL auto_increment,
`time` timestamp(14) NOT NULL,
`name` varchar(30) NOT NULL default '',
`message` text NOT NULL,
`file` longblob NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=5 ;Code: Select all
<form action="amb.php" method="post" enctype="multipart/form-data" name="form1">
<table width="38%" border="2" align="center" cellpadding="2" cellspacing="2" bordercolor="#999999">
<tr>
<td width="80%"><input type="text" name="name"> </td>
<td width="20%">Name</td>
</tr>
<tr>
<td><textarea name="message" cols="30" rows="5"></textarea></td>
<td>Message</td>
</tr>
<tr>
<td><input type="file" name="file"></td>
<td>Upload</td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Submit"></td>
<td>&nbsp;</td>
</tr>
</table>
</form>Code: Select all
<?php
$db = mysql_connect("localhost","username","cam");
mysql_select_db ("database");
$query = "INSERT INTO messages(name, message, file)
VALUES('".$_POSTї'name']."','".$_POSTї'message']."','".$_POSTї'file']."')";
$result = mysql_query($query);
echo 'Information entered.';
?>feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]