nikhilsnehilster Posted May 8, 2013 Share Posted May 8, 2013 is it possible to use div tag to store the image in database with php....can any one please help me.!!! Quote Link to comment https://forums.phpfreaks.com/topic/277784-how-to-save-image-in-database-using-div-tag/ Share on other sites More sharing options...
yomanny Posted May 8, 2013 Share Posted May 8, 2013 I'm not sure what you mean, use a div tag to save an image on the server? Confusing. Anyway, usually you save the image on the server and in the database you save the filename (and the path if you wish). No idea what you're really talking about, but read up on how to let users upload an image to the server. A quick google search gave me http://www.tizag.com/phpT/fileupload.php - W Quote Link to comment https://forums.phpfreaks.com/topic/277784-how-to-save-image-in-database-using-div-tag/#findComment-1429050 Share on other sites More sharing options...
jugesh Posted May 8, 2013 Share Posted May 8, 2013 $div = mysql_real_escape_string($_POST['contents']); // Make sure to clean the// data before putting SQL$sql = "INSERT INTO divs (contents) VALUES ('{$div}')"; Quote Link to comment https://forums.phpfreaks.com/topic/277784-how-to-save-image-in-database-using-div-tag/#findComment-1429067 Share on other sites More sharing options...
cyberRobot Posted May 8, 2013 Share Posted May 8, 2013 I'm still unsure what you mean by the div tag...are you talking about an HTML <div> tag? Or are you just referring to the PHP variable called "div"? The code provided should work as long as the POST variable actually comes from somewhere like an HTML form. And that the query is being executed: http://php.net/manual/en/function.mysql-query.php Note that you don't need the curly brackets in this case. <?php $sql = "INSERT INTO divs (contents) VALUES ('$div')"; ?> . Quote Link to comment https://forums.phpfreaks.com/topic/277784-how-to-save-image-in-database-using-div-tag/#findComment-1429087 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.