big-dog1965 Posted May 24, 2009 Author Share Posted May 24, 2009 Heres the process code for the form. I tried to replace $_POST with $_FILES then it put Arrey in the field not the image name. $query = "INSERT into `".$db_table."` (venue,address,date_1,time_1,date_2,time_2,date_3,time_3,date_4,time_4,host,host_email,venue_website,venue_phone,logo_image) VALUES ('" . $_POST['venue'] . "','" . $_POST['address'] . "','" . $_POST['date_1'] . "','" . $_POST['time_1'] . "','" . $_POST['date_2'] . "','" . $_POST['time_2'] . "','" . $_POST['date_3'] . "','" . $_POST['time_3'] . "','" . $_POST['date_4'] . "','" . $_POST['time_4'] . "','" . $_POST['host'] . "','" . $_POST['host_email'] . "','" . $_POST['venue_website'] . "','" . $_POST['venue_phone'] . "','" . $_POST['logo_image'] . "')"; mysql_query($query); Quote Link to comment https://forums.phpfreaks.com/topic/159319-solved-form-inserting-to-mysql-then-echoing-a-image-from-the-database-to-a-webpage/page/2/#findComment-841199 Share on other sites More sharing options...
MadTechie Posted May 24, 2009 Share Posted May 24, 2009 try replacing $_POST['logo_image'] with $_FILES['logo_image']['name'] (thats a guess) then upload a new files, if that fails i'll need to see the form Quote Link to comment https://forums.phpfreaks.com/topic/159319-solved-form-inserting-to-mysql-then-echoing-a-image-from-the-database-to-a-webpage/page/2/#findComment-841200 Share on other sites More sharing options...
big-dog1965 Posted May 24, 2009 Author Share Posted May 24, 2009 That worked , but for test I removed the image from the files folder and then it displayed a X image the size of what was the image I deleted from files folder. It didnt show the noimage. Quote Link to comment https://forums.phpfreaks.com/topic/159319-solved-form-inserting-to-mysql-then-echoing-a-image-from-the-database-to-a-webpage/page/2/#findComment-841257 Share on other sites More sharing options...
MadTechie Posted May 24, 2009 Share Posted May 24, 2009 thats because the value is still in the database, you could update the if statement to check both, if(empty($row['logo_image']) || !file_exists("admin/venues/files/{$row['logo_image']}")) { echo "<img src='admin/venues/files/noimage.gif'>"; // no image }else{ echo "<img src='admin/venues/files/{$row['logo_image']}'>"; // found image } Quote Link to comment https://forums.phpfreaks.com/topic/159319-solved-form-inserting-to-mysql-then-echoing-a-image-from-the-database-to-a-webpage/page/2/#findComment-841275 Share on other sites More sharing options...
big-dog1965 Posted May 24, 2009 Author Share Posted May 24, 2009 WORKS THANKS FOR ALL THE HELP MadTechie This is displaying code from mysql to a <DIV></DIV> on a web page. Heres the final code hopefully it will help others. Granted youll need to rename fields and stuff but may help Thanks again MadTechie $query= 'SELECT venue, address, date_1, time_1, date_2, time_2, date_3, time_3, date_4, time_4, host, host_email, venue_website, venue_phone, logo_image FROM Venues ORDER BY date_1 ASC LIMIT 0, 100'; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { if (!empty($row['venue'])) echo "<b>".$row['venue']."</b><br />\n"; if (!empty($row['address'])) echo $row['address']."<br />\n"; if (!empty($row['date_1'])) echo $row['date_1']." "; if (!empty($row['time_1'])) echo $row['time_1']."<br />\n"; if (!empty($row['date_2'])) echo $row['date_2']."<br />\n"; if (!empty($row['time_2'])) echo $row['time_2']."<br />\n"; if (!empty($row['date_3'])) echo $row['date_3']."<br />\n"; if (!empty($row['time_3'])) echo $row['time_3']."<br />\n"; if (!empty($row['date_4'])) echo $row['date_4']."<br />\n"; if (!empty($row['time_4'])) echo $row['time_4']."<br />\n"; if (!empty($row['host'])) echo "Host: ".$row['host']."<br />\n"; if (!empty($row['host_email'])) echo "Host Email: ".$row['host_email']."<br />\n"; if (!empty($row['venue_website'])) echo $row['venue_website']."<br />\n"; if (!empty($row['venue_phone'])) echo $row['venue_phone']."<br />\n"; if(empty($row['logo_image']) || !file_exists("directory where images are stored/{$row['logo_image']}")) { echo "<img src='directory where noimage.gif'is stored>"; // no image }else{ echo "<img src=' directory where images are stored/{$row['logo_image']}'>"; // found image } echo "<hr>"; } Quote Link to comment https://forums.phpfreaks.com/topic/159319-solved-form-inserting-to-mysql-then-echoing-a-image-from-the-database-to-a-webpage/page/2/#findComment-841322 Share on other sites More sharing options...
MadTechie Posted May 24, 2009 Share Posted May 24, 2009 your very welcome, (Marked as Solved) Quote Link to comment https://forums.phpfreaks.com/topic/159319-solved-form-inserting-to-mysql-then-echoing-a-image-from-the-database-to-a-webpage/page/2/#findComment-841338 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.