hi i am trying to upload an image to mysql as part of my college assignment but it just wont work, please have a look at this code and tell me where i am going wrong;
upload script;
<?php
// User details can be amended through this script
session_start();
include("dbconnect.inc");
if ($_POST[submit]){
$file = fopen($_POST['new_image'], "r");
$image = addslashes(fread($file, filesize($_POST['new_image'])));
$sql = "insert into student values('$POST[new_user]', '$POST
[new_pass]','$POST[new_fristname]','$POST[new_lastname]','$POST[new_DOB]','$POST[new_house]','$POST[new_town]','$POST[new_county]','$POST[new_country]','$POST[new_postcode]','$image');";
$result = mysql_query($sql,$conn);
fclose($file);
?>
<html>
<head></head>
<body><center>
<h2>Your details have been added to the Database</h2>
<a href="Home.php">Log In</a>
</center></body>
</html>
<?php
}
else {
<############# not sure if this should be here ############>
// Build an sql statment to return the student record whoes id
// matches that of the session variable.
$sql = "select * from student where studentid='". $_SESSION[id] . "';";
$result = mysql_query($sql,$conn);
$row = mysql_fetch_array($result);
<##################################################>
?>
<html>
<head>
</head>
<body><center>
<h2>Add Your details</h2>
<form action="<?php echo $PHP_SELF ?>" method="post" enctype="multipart/form-data">
<table>
<tr><td align="right">
here i have deleted other input boxes that account for the ones in the sql (just so its not so lengthy)
<tr><td align="right">
Add an Image :</td>
<td><input name="new_image" type="file" value="jpeg" accept="image/jpeg"/></td>
</tr>
<tr><td colspan="2" align="center">
<input type="submit" value="Save" name="submit"/></td>
</tr>
</table>
</form>
<p><a href="Home.php">Home</a></center></body>
</html>
<?php
}
?>
i have another script that gets the image to display;
<?php
header (Content-type: "image/jpeg");
// Connect to the database
include("dbconnect.inc");
// Build SQL statment that selects a student's modules
$sql = "select image from student where studentid='" . $_SESSION[id] . "',;
$result = mysql_query($sql,$conn);
$row = mysql_fetch_array($result);
$jpg = $row["image"];
?>
help would be really appreciated!