Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i used this code to sed the image to database

<?php
//conect to database
$con = mysql_connect('localhost', 'root', '') or die (mysql_error());
//select database table
$see = mysql_select_db("record",$con)or die ("cannot select DB");
//collect user's details
if (isset($_POST['submit'])){
//starting a sesion
session_start ();
$image=$_POST['image'];
$sql= "INSERT INTO register (image) VALUES('$image')";
mysql_query($sql);
$_SESSION['d'] ="
";
$_SESSION['de'] ="
";
$_SESSION['image'] = "";
header("location:department.php");

}

?>

What I have tried:

i have tried this and is not working
<?php
$con = mysql_connect('localhost', 'root', '') or die ("SERVER NOT FOUND".mysql_error());
$sel = mysql_select_db("record",$con)or die ("cannot select DB");
$result= @mysql_query (' SELECT imageROM register');
if(!$result){
exit('

Error performing query: ' .mysql_error() . '

');
}
while($row = mysql_fetch_array($result)){
echo '

';
echo '

';
echo"
";
echo"";
echo"
";
}
?>
Posted
Updated 10-Sep-17 2:31am
Comments
Richard MacCutchan 9-Sep-17 1:32am    
What does "not working" mean?
[no name] 10-Sep-17 8:27am    
show your error

1 solution

<if it is exact code of your then check your query
query should be
select image from register
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900