Coldman Posted March 18, 2007 Share Posted March 18, 2007 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>"; ?> Link to comment https://forums.phpfreaks.com/topic/43196-simple-help-deleting-one-row-from-mysql-table/ Share on other sites More sharing options...
tauchai83 Posted March 18, 2007 Share Posted March 18, 2007 put this: <FORM ACTION='" . $_SERVER['PHP_SELF']."' METHOD=POST> Link to comment https://forums.phpfreaks.com/topic/43196-simple-help-deleting-one-row-from-mysql-table/#findComment-209741 Share on other sites More sharing options...
tauchai83 Posted March 18, 2007 Share Posted March 18, 2007 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); } Link to comment https://forums.phpfreaks.com/topic/43196-simple-help-deleting-one-row-from-mysql-table/#findComment-209743 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.