Jump to content

Simple help - deleting one row from mysql table


Coldman

Recommended Posts

The problem is like this:

I want to delete one row of a mysql table, and still to be in the same page, but the page needs to be reloaded and to give me new results

 

this is the Code:

<?php

 

 

 

  $db="harbini";

$con =  mysql_connect('localhost','root','');

  mysql_select_db($db);

$Quer=mysql_query("select imagepath, IdUser, productName, CompanyName, Serie, Category from cart where Iduser = '$username' ");

print "\n";

 

 

 

    print "<table  >\n";

  while ( $rreshti = mysql_fetch_row( $Quer) )

    {

 

    print "<table  >\n";

        $i=0;

        print "<tr>\n";

        foreach ( $rreshti as $fusha )

        {

        $i=$i+1;

        if ($i==1){

 

          print "\t<td > <image src=".$fusha." width=650 height=350></td><td bgcolor=#ffffff>\n";

        }

        else

 

    print "\t

".$fusha."</br>\n";

 

 

        }

<form>

 

print '<input type="submit"  Value ="Delete" ></td></tr></form></table>

</br></td></tr>;

     

 

print "</table>";

 

?>

another thing..i noticed you did not give a name to identify the submit button.

 

print '<input type="submit" name="submit" Value ="Delete" ></td></tr></form></table>

 

 

to delete:

 

if (isset($submit)){

$sql="DELETE ..........FROM............WHERE.........";

mysql_query($sql);

 

 

}

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.