Mysql table rows delete HELP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dejan

    Mysql table rows delete HELP

    Hy,

    Sorry for my terreble english

    I have this simple code for deleting rows in mysql table...
    Everything works fine with it.
    So, what do i wanna do...:
    my sql table looks something like this:
    id Name Surname pictr0 picrt1 pictr2
    pictr3
    1 Ivan Johnes 1.jpg 120.jpg 111.jpg
    pic11.jpg
    2 John Doe 2.jpg pic123.jpg img13.jpg
    pic12.jpg

    images (pictr0, pictr1...) are located in images/ folder..., and when i
    delete one row i wanna pictures deleted too.
    I have used this script, buth i realised i'm only deleting data in sql
    tabel, and images are filling my web hosting space.
    Any ideas?

    Tnx in advance
    Dejan
    ----------------------------------------

    <?php
    $host="localhos t"; // Host name
    $username="xyxx x"; // Mysql username
    $password="xxxx x"; // Mysql password
    $db_name="delet e"; // Database name
    $tbl_name="test _mysql"; // Table name

    // Connect to server and select databse.
    mysql_connect(" $host", "$username" , "$password" )or die("cannot connect");
    mysql_select_db ("$db_name") or die("cannot select DB");

    $sql="SELECT * FROM $tbl_name";
    $result=mysql_q uery($sql);

    $count=mysql_nu m_rows($result) ;
    <table width="400" border="0" cellspacing="1" cellpadding="0" >
    <tr>
    <td><form name="form1" method="post" action="">
    <table width="400" border="0" cellpadding="3" cellspacing="1"
    bgcolor="#CCCCC C">
    <tr>
    <td bgcolor="#FFFFF F">&nbsp;</td>
    <td colspan="4" bgcolor="#FFFFF F"><strong>Dele te multiple rows in
    mysql</strong> </td>
    </tr>
    <tr>
    ..
    ..(simple html code)
    ..
    </tr>
    <?php
    while($rows=mys ql_fetch_array( $result)){
    ?>
    <tr>
    <td align="center" bgcolor="#FFFFF F"><input name="checkbox[]"
    type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td>
    <td bgcolor="#FFFFF F"><? echo $rows['id']; ?></td>
    <td bgcolor="#FFFFF F"><? echo $rows['name']; ?></td>
    <td bgcolor="#FFFFF F"><? echo $rows['lastname']; ?></td>
    <td bgcolor="#FFFFF F"><? echo $rows['email']; ?></td>
    </tr>
    <?php
    }
    ?>
    <tr>
    <td colspan="5" align="center" bgcolor="#FFFFF F"><input name="delete"
    type="submit" id="delete" value="Delete"> </td>
    </tr>
    <?
    // Check if delete button active, start this
    if($delete){
    for($i=0;$i<$co unt;$i++){
    $del_id = $checkbox[$i];
    $sql = "DELETE FROM $tbl_name WHERE id='$del_id'";
    $result = mysql_query($sq l);
    }

    // if successful redirect to delete_multiple .php
    if($result){
    echo "<meta http-equiv=\"refresh \" content=\"0;URL =delete.php\">" ;
    }
    }
    mysql_close();
    ?>


  • haggis@_your_teeth_nerdshack.com

    #2
    Re: Mysql table rows delete HELP

    On Sat, 8 Apr 2006 12:34:20 +0200, "Dejan"
    <ddundov_REMOVE _@veleri.hr> wrote:
    [color=blue][color=green][color=darkred]
    >>>Hy,
    >>>
    >>>Sorry for my terreble english
    >>>
    >>>I have this simple code for deleting rows in mysql table...
    >>>Everything works fine with it.
    >>>So, what do i wanna do...:
    >>>my sql table looks something like this:
    >>>id Name Surname pictr0 picrt1 pictr2
    >>>pictr3
    >>>1 Ivan Johnes 1.jpg 120.jpg 111.jpg
    >>>pic11.jpg
    >>>2 John Doe 2.jpg pic123.jpg img13.jpg
    >>>pic12.jpg
    >>>
    >>>images (pictr0, pictr1...) are located in images/ folder..., and when i
    >>>delete one row i wanna pictures deleted too.
    >>>I have used this script, buth i realised i'm only deleting data in sql
    >>>tabel, and images are filling my web hosting space.
    >>>Any ideas?
    >>>
    >>>Tnx in advance
    >>>Dejan
    >>>----------------------------------------
    >>>
    >>><?php
    >>>$host="local host"; // Host name
    >>>$username="x yxxx"; // Mysql username
    >>>$password="x xxxx"; // Mysql password
    >>>$db_name="de lete"; // Database name
    >>>$tbl_name="t est_mysql"; // Table name
    >>>
    >>>// Connect to server and select databse.
    >>>mysql_connec t("$host", "$username" , "$password" )or die("cannot connect");
    >>>mysql_select _db("$db_name") or die("cannot select DB");
    >>>
    >>>$sql="SELE CT * FROM $tbl_name";
    >>>$result=mysq l_query($sql);
    >>>
    >>>$count=mysql _num_rows($resu lt);
    >>><table width="400" border="0" cellspacing="1" cellpadding="0" >
    >>><tr>
    >>><td><form name="form1" method="post" action="">
    >>><table width="400" border="0" cellpadding="3" cellspacing="1"
    >>>bgcolor="#CC CCCC">
    >>><tr>
    >>><td bgcolor="#FFFFF F">&nbsp;</td>
    >>><td colspan="4" bgcolor="#FFFFF F"><strong>Dele te multiple rows in
    >>>mysql</strong> </td>
    >>></tr>
    >>><tr>
    >>>.
    >>>.(simple html code)
    >>>.
    >>></tr>
    >>><?php
    >>>while($rows= mysql_fetch_arr ay($result)){
    >>>?>
    >>><tr>
    >>><td align="center" bgcolor="#FFFFF F"><input name="checkbox[]"
    >>>type="checkb ox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td>
    >>><td bgcolor="#FFFFF F"><? echo $rows['id']; ?></td>
    >>><td bgcolor="#FFFFF F"><? echo $rows['name']; ?></td>
    >>><td bgcolor="#FFFFF F"><? echo $rows['lastname']; ?></td>
    >>><td bgcolor="#FFFFF F"><? echo $rows['email']; ?></td>
    >>></tr>
    >>><?php
    >>>}
    >>>?>
    >>><tr>
    >>><td colspan="5" align="center" bgcolor="#FFFFF F"><input name="delete"
    >>>type="submit " id="delete" value="Delete"> </td>
    >>></tr>
    >>><?
    >>>// Check if delete button active, start this
    >>>if($delete ){
    >>>for($i=0;$i< $count;$i++){
    >>>$del_id = $checkbox[$i];
    >>>$sql = "DELETE FROM $tbl_name WHERE id='$del_id'";
    >>>$result = mysql_query($sq l);
    >>>}
    >>>
    >>>// if successful redirect to delete_multiple .php
    >>>if($result ){
    >>>echo "<meta http-equiv=\"refresh \" content=\"0;URL =delete.php\">" ;
    >>>}
    >>>}
    >>>mysql_close( );
    >>>?>
    >>>[/color][/color][/color]

    Have a look at this -
    Checks whether a file or directory exists

    and then

    Remove _your_teeth_ to reply.

    Comment

    • strawberry

      #3
      Re: Mysql table rows delete HELP

      Also, is that really the structure of your table!?!

      I'd consider a structure like this instead...

      users

      user_id f_name l_name
      1 John Lennon
      2 Paul McCartney
      3 George Harrison
      4 Ringo Starr

      images

      image_id image_name
      1 yoko.jpg
      2 julia.jpg
      3 linda.jpg
      4 heather.jpg
      5 patti.jpg
      6 olivia.jpg
      7 barbara.jpg

      user_images

      user_id image_id
      1 1
      1 2
      2 3
      2 4
      3 5
      3 6
      4 7

      Comment

      • Guest's Avatar

        #4
        Re: Mysql table rows delete HELP

        "strawberry " <zac.carey@gmai l.com>[color=blue]
        > I'd consider a structure like this instead...[/color]

        And I think this will be better (if two different users cannot share one
        image):
        [color=blue]
        > users
        >
        > user_id f_name l_name
        > 1 John Lennon
        > 2 Paul McCartney
        > 3 George Harrison
        > 4 Ringo Starr
        >[/color]
        images

        image_id image_name user_id
        1 yoko.jpg 1
        2 julia.jpg 2
        3 linda.jpg 1
        4 heather.jpg 2
        5 patti.jpg 1
        6 olivia.jpg 3
        7 barbara.jpg 3

        Regards,
        Talthen



        Comment

        • fastrat

          #5
          Re: Mysql table rows delete HELP

          hey pal :) you are not deletin the files
          because in php code you wrote del " $sql = "DELETE FROM $tbl_name WHERE
          id='$del_id'";[color=blue]
          > $result = mysql_query($sq l);" but wont you try do write php code to delete files too like"ifdel name then del *.jpg;" :) then put it there its gonna work[/color]
          by the way i am not php programmer but i undestand it because i have
          knowledge of other programs and thats the mistake yuo have put there
          you delete only name by code (only one action) but not jpgs

          Comment

          • Dejan

            #6
            Re: Mysql table rows delete HELP

            I know about this two functions.
            I'm looking for a way to implement something like this:
            When i'm deleting row, script select's this 4 coloumns form that row first,
            put's it into an array.
            Then i have file names in array, and i cann delete (unlink etc.) them, and
            the row.
            I understend that, buth i don't know how to implement it in this delete
            loop.
            Dejan


            <haggis@_your_t eeth_nerdshack. com> wrote in message
            news:5a8f32d42l h1tb2lb1uij46ig 1ocfh1cg6@4ax.c om...[color=blue]
            > On Sat, 8 Apr 2006 12:34:20 +0200, "Dejan"
            > <ddundov_REMOVE _@veleri.hr> wrote:
            >[color=green][color=darkred]
            > >>>Hy,
            > >>>
            > >>>Sorry for my terreble english
            > >>>
            > >>>I have this simple code for deleting rows in mysql table...
            > >>>Everything works fine with it.
            > >>>So, what do i wanna do...:
            > >>>my sql table looks something like this:
            > >>>id Name Surname pictr0 picrt1 pictr2
            > >>>pictr3
            > >>>1 Ivan Johnes 1.jpg 120.jpg 111.jpg
            > >>>pic11.jpg
            > >>>2 John Doe 2.jpg pic123.jpg img13.jpg
            > >>>pic12.jpg
            > >>>
            > >>>images (pictr0, pictr1...) are located in images/ folder..., and when i
            > >>>delete one row i wanna pictures deleted too.
            > >>>I have used this script, buth i realised i'm only deleting data in sql
            > >>>tabel, and images are filling my web hosting space.
            > >>>Any ideas?
            > >>>
            > >>>Tnx in advance
            > >>>Dejan
            > >>>----------------------------------------
            > >>>
            > >>><?php
            > >>>$host="local host"; // Host name
            > >>>$username="x yxxx"; // Mysql username
            > >>>$password="x xxxx"; // Mysql password
            > >>>$db_name="de lete"; // Database name
            > >>>$tbl_name="t est_mysql"; // Table name
            > >>>
            > >>>// Connect to server and select databse.
            > >>>mysql_connec t("$host", "$username" , "$password" )or die("cannot[/color][/color][/color]
            connect");[color=blue][color=green][color=darkred]
            > >>>mysql_select _db("$db_name") or die("cannot select DB");
            > >>>
            > >>>$sql="SELE CT * FROM $tbl_name";
            > >>>$result=mysq l_query($sql);
            > >>>
            > >>>$count=mysql _num_rows($resu lt);
            > >>><table width="400" border="0" cellspacing="1" cellpadding="0" >
            > >>><tr>
            > >>><td><form name="form1" method="post" action="">
            > >>><table width="400" border="0" cellpadding="3" cellspacing="1"
            > >>>bgcolor="#CC CCCC">
            > >>><tr>
            > >>><td bgcolor="#FFFFF F">&nbsp;</td>
            > >>><td colspan="4" bgcolor="#FFFFF F"><strong>Dele te multiple rows in
            > >>>mysql</strong> </td>
            > >>></tr>
            > >>><tr>
            > >>>.
            > >>>.(simple html code)
            > >>>.
            > >>></tr>
            > >>><?php
            > >>>while($rows= mysql_fetch_arr ay($result)){
            > >>>?>
            > >>><tr>
            > >>><td align="center" bgcolor="#FFFFF F"><input name="checkbox[]"
            > >>>type="checkb ox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td>
            > >>><td bgcolor="#FFFFF F"><? echo $rows['id']; ?></td>
            > >>><td bgcolor="#FFFFF F"><? echo $rows['name']; ?></td>
            > >>><td bgcolor="#FFFFF F"><? echo $rows['lastname']; ?></td>
            > >>><td bgcolor="#FFFFF F"><? echo $rows['email']; ?></td>
            > >>></tr>
            > >>><?php
            > >>>}
            > >>>?>
            > >>><tr>
            > >>><td colspan="5" align="center" bgcolor="#FFFFF F"><input name="delete"
            > >>>type="submit " id="delete" value="Delete"> </td>
            > >>></tr>
            > >>><?
            > >>>// Check if delete button active, start this
            > >>>if($delete ){
            > >>>for($i=0;$i< $count;$i++){
            > >>>$del_id = $checkbox[$i];
            > >>>$sql = "DELETE FROM $tbl_name WHERE id='$del_id'";
            > >>>$result = mysql_query($sq l);
            > >>>}
            > >>>
            > >>>// if successful redirect to delete_multiple .php
            > >>>if($result ){
            > >>>echo "<meta http-equiv=\"refresh \" content=\"0;URL =delete.php\">" ;
            > >>>}
            > >>>}
            > >>>mysql_close( );
            > >>>?>
            > >>>[/color][/color]
            >
            > Have a look at this -
            > http://uk.php.net/file_exists
            > and then
            > http://uk.php.net/unlink
            > Remove _your_teeth_ to reply.[/color]


            Comment

            • Dejan

              #7
              Re: Mysql table rows delete HELP

              My table structure i's like that.
              No one cann't have same image name. My data in the table really look's like
              this...

              id Name Surname Image1
              Image2
              mmijic27542 Mirjana Mijic mmijic27542_776 _mijic1_v.jpg
              mmijic27542_2_7 78_mijic3_v.jpg

              and manny more coloumns in this row.
              Id, and images names are generated random during insert, depending on
              peoples name, surname, and random function.
              So no one cann't have the same id, or images names.

              Dejan



              strawberry <zac.carey@gmai l.com> wrote in message
              news:1144500048 .823058.179400@ z34g2000cwc.goo glegroups.com.. .[color=blue]
              > Also, is that really the structure of your table!?!
              >
              > I'd consider a structure like this instead...
              >
              > users
              >
              > user_id f_name l_name
              > 1 John Lennon
              > 2 Paul McCartney
              > 3 George Harrison
              > 4 Ringo Starr
              >
              > images
              >
              > image_id image_name
              > 1 yoko.jpg
              > 2 julia.jpg
              > 3 linda.jpg
              > 4 heather.jpg
              > 5 patti.jpg
              > 6 olivia.jpg
              > 7 barbara.jpg
              >
              > user_images
              >
              > user_id image_id
              > 1 1
              > 1 2
              > 2 3
              > 2 4
              > 3 5
              > 3 6
              > 4 7
              >[/color]


              Comment

              • Dejan

                #8
                Re: Mysql table rows delete HELP

                I know how to delete files in simple code, but here i have some kind of
                loop. As i have writen before this is my req:
                [color=blue]
                >I'm looking for a way to implement something like this:
                >When i'm deleting row, script select's this 4 coloumns form that row first,[/color]
                put's it into an array.[color=blue]
                >Then i have file names in array, and i cann delete (unlink etc.) them, and[/color]
                the row.[color=blue]
                >I understend that, buth i don't know how to implement it in this delete[/color]
                loop.

                Dejan


                -----------------
                fastrat <turalsedirov@g mail.com> wrote in message
                news:1144648026 .524311.234660@ v46g2000cwv.goo glegroups.com.. .[color=blue]
                > hey pal :) you are not deletin the files
                > because in php code you wrote del " $sql = "DELETE FROM $tbl_name WHERE
                > id='$del_id'";[color=green]
                > > $result = mysql_query($sq l);" but wont you try do write php code to[/color][/color]
                delete files too like"ifdel name then del *.jpg;" :) then put it there its
                gonna work[color=blue]
                > by the way i am not php programmer but i undestand it because i have
                > knowledge of other programs and thats the mistake yuo have put there
                > you delete only name by code (only one action) but not jpgs
                >[/color]


                Comment

                • Jerry Stuckle

                  #9
                  Re: Mysql table rows delete HELP

                  Dejan wrote:[color=blue]
                  > Hy,
                  >
                  > Sorry for my terreble english
                  >
                  > I have this simple code for deleting rows in mysql table...
                  > Everything works fine with it.
                  > So, what do i wanna do...:
                  > my sql table looks something like this:
                  > id Name Surname pictr0 picrt1 pictr2
                  > pictr3
                  > 1 Ivan Johnes 1.jpg 120.jpg 111.jpg
                  > pic11.jpg
                  > 2 John Doe 2.jpg pic123.jpg img13.jpg
                  > pic12.jpg
                  >
                  > images (pictr0, pictr1...) are located in images/ folder..., and when i
                  > delete one row i wanna pictures deleted too.
                  > I have used this script, buth i realised i'm only deleting data in sql
                  > tabel, and images are filling my web hosting space.
                  > Any ideas?
                  >
                  > Tnx in advance
                  > Dejan
                  > ----------------------------------------
                  >
                  > <?php
                  > $host="localhos t"; // Host name
                  > $username="xyxx x"; // Mysql username
                  > $password="xxxx x"; // Mysql password
                  > $db_name="delet e"; // Database name
                  > $tbl_name="test _mysql"; // Table name
                  >
                  > // Connect to server and select databse.
                  > mysql_connect(" $host", "$username" , "$password" )or die("cannot connect");
                  > mysql_select_db ("$db_name") or die("cannot select DB");
                  >
                  > $sql="SELECT * FROM $tbl_name";
                  > $result=mysql_q uery($sql);
                  >
                  > $count=mysql_nu m_rows($result) ;
                  > <table width="400" border="0" cellspacing="1" cellpadding="0" >
                  > <tr>
                  > <td><form name="form1" method="post" action="">
                  > <table width="400" border="0" cellpadding="3" cellspacing="1"
                  > bgcolor="#CCCCC C">
                  > <tr>
                  > <td bgcolor="#FFFFF F">&nbsp;</td>
                  > <td colspan="4" bgcolor="#FFFFF F"><strong>Dele te multiple rows in
                  > mysql</strong> </td>
                  > </tr>
                  > <tr>
                  > .
                  > .(simple html code)
                  > .
                  > </tr>
                  > <?php
                  > while($rows=mys ql_fetch_array( $result)){
                  > ?>
                  > <tr>
                  > <td align="center" bgcolor="#FFFFF F"><input name="checkbox[]"
                  > type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td>
                  > <td bgcolor="#FFFFF F"><? echo $rows['id']; ?></td>
                  > <td bgcolor="#FFFFF F"><? echo $rows['name']; ?></td>
                  > <td bgcolor="#FFFFF F"><? echo $rows['lastname']; ?></td>
                  > <td bgcolor="#FFFFF F"><? echo $rows['email']; ?></td>
                  > </tr>
                  > <?php
                  > }
                  > ?>
                  > <tr>
                  > <td colspan="5" align="center" bgcolor="#FFFFF F"><input name="delete"
                  > type="submit" id="delete" value="Delete"> </td>
                  > </tr>
                  > <?
                  > // Check if delete button active, start this
                  > if($delete){
                  > for($i=0;$i<$co unt;$i++){
                  > $del_id = $checkbox[$i];
                  > $sql = "DELETE FROM $tbl_name WHERE id='$del_id'";
                  > $result = mysql_query($sq l);
                  > }
                  >
                  > // if successful redirect to delete_multiple .php
                  > if($result){
                  > echo "<meta http-equiv=\"refresh \" content=\"0;URL =delete.php\">" ;
                  > }
                  > }
                  > mysql_close();
                  > ?>
                  >
                  >[/color]

                  You'll need to fetch the rows first, then delete. For instance - if `id` is the
                  primary key to your table:

                  foreach($checkb ox as $del_id) { // Personal preference - I like foreach
                  $query = "select pictr0, pictr1, pictr2, pictr3 from $tblname where id=$del_id";
                  $result = mysql_query($qu ery);
                  if ($result && mysql_num_rows > 0) {
                  $pics = mysql_fetch_arr ay($result);
                  unlink($pictr0) ;
                  unlink($pictr1) ;
                  unlink($pictr2) ;
                  unlink($pictr3) ;
                  $query = "DELETE FROM $tblname WHERE id='$del_id'";
                  $result = mysql_query($qu ery);
                  echo "<meta http-equiv=\"refresh \" content=\"0;URL =delete.php\">" ;
                  }
                  else
                  if ($result == null)
                  echo "Error fetching data: " . mysql_error();
                  else
                  echo "No data returned";


                  --
                  =============== ===
                  Remove the "x" from my email address
                  Jerry Stuckle
                  JDS Computer Training Corp.
                  jstucklex@attgl obal.net
                  =============== ===

                  Comment

                  • Dejan

                    #10
                    Re: Mysql table rows delete HELP

                    This is true help, thank you very much
                    Dejan.


                    Jerry Stuckle <jstucklex@attg lobal.net> wrote in message
                    news:MYednUoJOp nKoafZnZ2dnUVZ_ uidnZ2d@comcast .com...[color=blue]
                    > Dejan wrote:[color=green]
                    > > Hy,
                    > >
                    > > Sorry for my terreble english
                    > >
                    > > I have this simple code for deleting rows in mysql table...
                    > > Everything works fine with it.
                    > > So, what do i wanna do...:
                    > > my sql table looks something like this:
                    > > id Name Surname pictr0 picrt1 pictr2
                    > > pictr3
                    > > 1 Ivan Johnes 1.jpg 120.jpg 111.jpg
                    > > pic11.jpg
                    > > 2 John Doe 2.jpg pic123.jpg img13.jpg
                    > > pic12.jpg
                    > >
                    > > images (pictr0, pictr1...) are located in images/ folder..., and when i
                    > > delete one row i wanna pictures deleted too.
                    > > I have used this script, buth i realised i'm only deleting data in sql
                    > > tabel, and images are filling my web hosting space.
                    > > Any ideas?
                    > >
                    > > Tnx in advance
                    > > Dejan
                    > > ----------------------------------------
                    > >
                    > > <?php
                    > > $host="localhos t"; // Host name
                    > > $username="xyxx x"; // Mysql username
                    > > $password="xxxx x"; // Mysql password
                    > > $db_name="delet e"; // Database name
                    > > $tbl_name="test _mysql"; // Table name
                    > >
                    > > // Connect to server and select databse.
                    > > mysql_connect(" $host", "$username" , "$password" )or die("cannot[/color][/color]
                    connect");[color=blue][color=green]
                    > > mysql_select_db ("$db_name") or die("cannot select DB");
                    > >
                    > > $sql="SELECT * FROM $tbl_name";
                    > > $result=mysql_q uery($sql);
                    > >
                    > > $count=mysql_nu m_rows($result) ;
                    > > <table width="400" border="0" cellspacing="1" cellpadding="0" >
                    > > <tr>
                    > > <td><form name="form1" method="post" action="">
                    > > <table width="400" border="0" cellpadding="3" cellspacing="1"
                    > > bgcolor="#CCCCC C">
                    > > <tr>
                    > > <td bgcolor="#FFFFF F">&nbsp;</td>
                    > > <td colspan="4" bgcolor="#FFFFF F"><strong>Dele te multiple rows in
                    > > mysql</strong> </td>
                    > > </tr>
                    > > <tr>
                    > > .
                    > > .(simple html code)
                    > > .
                    > > </tr>
                    > > <?php
                    > > while($rows=mys ql_fetch_array( $result)){
                    > > ?>
                    > > <tr>
                    > > <td align="center" bgcolor="#FFFFF F"><input name="checkbox[]"
                    > > type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td>
                    > > <td bgcolor="#FFFFF F"><? echo $rows['id']; ?></td>
                    > > <td bgcolor="#FFFFF F"><? echo $rows['name']; ?></td>
                    > > <td bgcolor="#FFFFF F"><? echo $rows['lastname']; ?></td>
                    > > <td bgcolor="#FFFFF F"><? echo $rows['email']; ?></td>
                    > > </tr>
                    > > <?php
                    > > }
                    > > ?>
                    > > <tr>
                    > > <td colspan="5" align="center" bgcolor="#FFFFF F"><input name="delete"
                    > > type="submit" id="delete" value="Delete"> </td>
                    > > </tr>
                    > > <?
                    > > // Check if delete button active, start this
                    > > if($delete){
                    > > for($i=0;$i<$co unt;$i++){
                    > > $del_id = $checkbox[$i];
                    > > $sql = "DELETE FROM $tbl_name WHERE id='$del_id'";
                    > > $result = mysql_query($sq l);
                    > > }
                    > >
                    > > // if successful redirect to delete_multiple .php
                    > > if($result){
                    > > echo "<meta http-equiv=\"refresh \" content=\"0;URL =delete.php\">" ;
                    > > }
                    > > }
                    > > mysql_close();
                    > > ?>
                    > >
                    > >[/color]
                    >
                    > You'll need to fetch the rows first, then delete. For instance - if `id`[/color]
                    is the[color=blue]
                    > primary key to your table:
                    >
                    > foreach($checkb ox as $del_id) { // Personal preference - I like foreach
                    > $query = "select pictr0, pictr1, pictr2, pictr3 from $tblname where[/color]
                    id=$del_id";[color=blue]
                    > $result = mysql_query($qu ery);
                    > if ($result && mysql_num_rows > 0) {
                    > $pics = mysql_fetch_arr ay($result);
                    > unlink($pictr0) ;
                    > unlink($pictr1) ;
                    > unlink($pictr2) ;
                    > unlink($pictr3) ;
                    > $query = "DELETE FROM $tblname WHERE id='$del_id'";
                    > $result = mysql_query($qu ery);
                    > echo "<meta http-equiv=\"refresh \" content=\"0;URL =delete.php\">" ;
                    > }
                    > else
                    > if ($result == null)
                    > echo "Error fetching data: " . mysql_error();
                    > else
                    > echo "No data returned";
                    >
                    >
                    > --
                    > =============== ===
                    > Remove the "x" from my email address
                    > Jerry Stuckle
                    > JDS Computer Training Corp.
                    > jstucklex@attgl obal.net
                    > =============== ===[/color]


                    Comment

                    Working...