Click here to Skip to main content
15,867,860 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
prepare("SELECT * from tb where pNo=:pNo");
$stm->bindParam('pNo',$pNo);
$stm->execute();
$stm->fetch(PDO::FETCH_ASSOC);
while ($row = $stm->fetch() ){
echo "";
}

What I have tried:

im try to display my image that i already save into database
Posted
Updated 9-Aug-20 23:10pm
v3
Comments
Richard Deeming 6-Jul-20 6:56am    
Have you saved the image in the database, or have you saved the path of the image in the database?

The code you've shown suggests you've saved the image to disk on the server, and saved the path in the database.
Richard MacCutchan 10-Aug-20 5:14am    
You have updated the question, but you still have not given any details of what the problem is.

1 solution

In a nutshell, I do this by converting the image file into a base64 string, then retrieve the string and convert it from base64 to a file.
 
Share this answer
 
Comments
Ibrahim Hassan 1234 10-Jul-20 16:24pm    
please sir can you help me the code on how to convert it.
lenniscata 15-Jul-20 20:42pm    
Just search, how to convert file to base64 on the language you are using, in C# will be something like this
To convert to base64:
Byte[] bytes = File.ReadAllBytes("path");
String base64String = Convert.ToBase64String(bytes);

To Revert from base64 to file:
bytes[] bytes = Convert.FromBase64String(base64String);
File.WriteAllBytes("path", bytes);

Ibrahim Hassan 1234 12-Jul-20 1:50am    
please can you help me with the code on how to convert my own image

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