473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to display and be able to delete them in MySql

Ive added my picture in database, but now I want to display them and be able to delete them.My database name is cms, my table is babies and my column is pic_name(contains a path and image name)
Jul 3 '14 #1
2 1022
Here is my code for displaying images from cms :
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.    <head>
  3.      <title>Delete Images</title>
  4.       <meta http-equiv="Content-Type" content="text/html; charset=isc-8859-1">
  5.     </Head>
  6.   <body>
  7.  <?php
  8.  include("mysqlconnect.php"); 
  9.  $res=mysql_query("select * from babies");
  10.  echo "<table>";
  11.  while($row=mysql_fetch_array($res))
  12.  {
  13.    echo "<tr>";
  14.    echo "<td>";?><img src="<?php echo $row["pic_name"]; ?>" height="100" width="100"> <?php echo "</td>";
  15.  
  16.    echo "</tr>";
  17.  }
  18.  echo "</table>";
  19.  ?>  
  20.   </body>
  21.  </html>
Jul 3 '14 #2
Dormilich
8,658 Expert Mod 8TB
you delete the images by selecting the image by ID (which you have to fetch from the DB as well), go to the denoted resource (the actual image), delete it from the FS, and then delete the DB entry of said ID. (this would make sure you have no unrecognised (by the DB) images. if you reverse the order (first delete in the DB, then in the FS) you may have leftover images, but also no broken links.
Jul 4 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: kindermaxiz | last post by:
hi there i have a mysql table and i want the user to add columns using a php interface and then display the table with the newly added column. I was thinking about putting all the columns...
4
imarkdesigns
by: imarkdesigns | last post by:
Hello everyone.. a newbie programmer here wants to ask why is my codes for deleting rows from my databse won't work.... seems that this codes spread to the net and no one refuse to correct it... ...
10
pezholio
by: pezholio | last post by:
Hi, I'm trying to put together a page that deletes records from a database based on if an item is unticked, I've got the existing items in an array (let's call it array1 for the sake of argument):...
1
by: recordlovelife | last post by:
Hey guys, ill try to make this simple. I want to make a GUI for a client so that they can delete news entries that they have posted. I figure I can code a site that will query the table for the news...
6
wadro21
by: wadro21 | last post by:
Hello everyone, i am trying to pull from a myql database all records from a table with multiple rows. i need to be able to call the data from each row one by one i would asume from an array. the...
4
by: foss | last post by:
HI all, I am able to upload the image as blob to mysql. but while displaying the image i cant display it properly . The code used for uploading image to mysql inserts data into mysql table.The...
1
by: ashfaqbinnazar | last post by:
Dear friends, How can i display messages from mysql database in each rows with delete and reply button. Thanks in advance. Here is my code. i have created a page like scrapbook. and splitted the...
0
by: prakashghai | last post by:
After spending 3 days on internet and struggling with so many different forums , i have found a match and similar case of my problem here. Friends, I am zero in PHP, but still i have managed to do...
5
DTeCH
by: DTeCH | last post by:
Hello all, I need to delete records from a table in a MySQL database that are more than 700 days old. There is a column with the time of the record's entry "pPostDate", & the dates are in RFC...
15
by: Monomita Har | last post by:
I want to show a category based shopping items with images on web page that can be found in the most Online shopping sites.I crated two mysql tables: Ist with id, category_name and 2nd with id,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.