I am currently trying upload a picture along with a title and some text for a companies staff to a mysql database.
for example John Doe, President
[picture] John Doe started at this company ...
so I have created my database:
CREATE TABLE team (
id INT(9)DEFAULT '0' NOT NULL AUTO_INCREMENT,
title varchar(255),
picture longblob,
description blob,
PRIMARY KEY(id),
UNIQUE KEY(id)
);
I have two pages for practical purposes I'll call them team1.php3 and team2.php3:
[team1.php3] - only pertinant code
<FORM ENCTYPE="multipart/form-data" ACTION="team2.php3" METHOD=POST>
<INPUT TYPE="text" name="title">
<INPUT TYPE="text" name="decription">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000">
Send this file:<INPUT NAME="picture" TYPE="file">
<INPUT TYPE="submit" VALUE="Send File">
</FORM>
[team2.php3] - only pertinant code
<?
$$title = $title;
$$picture = $picture;
$$description = $description;
$db = mysql_connect ("localhost", "user", "pass");
mysql_db_query("db_name", $db);
$sql="INSERT INTO team
(id,title,picture, description)
VALUES ('$id','$title','$picture','$description')";
$result= mysql_query($sql);
?>
So obviously it doesn't work or wouldn't of posted this topic. Please help, i don't how to show the picture either can I use an array just like I would with text.
Please help!!!!!!!!!
Thanks! 🙂
Adam