Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Script That Deletes A Row In A Mysql Database Usin
kvarnerexpress
post Sep 2 2005, 07:01 PM
Post #1


Super Member
*********

Group: Members
Posts: 407
Joined: 13-December 04
Member No.: 2,696



I have just made a script that deletes a row in a mysql database using an image as a button.

However it will only work in FireFox and not in IE.
Can any one see away around this and help me root out the problem.

This is the script in short:
PHP Code:
CODE
$query_products = "SELECT * FROM manufacturer ORDER BY name ASC";
include('external_files/pagination.php');

   // If the form was submitted, delete the items selected from the database
if(isset($_POST['delete'])){

 $query = 'DELETE FROM manufacturer WHERE manufacturer_id = '.(int)$_POST['delete']; // or die() doesn't go here
 $result = mysql_query($query) or print mysql_error();
echo"{$row_products['manufacturer_id']}";
       if ($result) { // If it ran OK.
           echo" <center><font color=\"#00CC00\">The manufacturer was Deleted!</font></center> ";
           $query_products = "SELECT * FROM manufacturer ORDER BY name ASC";
           include('external_files/pagination.php');
       } else { // If it did not run OK.
               // Send a message to the error log, if desired.
               echo"<div class='error'>The manufacturer could not be deleted due to a system error. We apologize for any inconvenience.</div>";
           }        
}?>
<!-- Call your variables -->


and:
PHP Code:
CODE

//.....etc etc
do {     ?><form action="<?php echo $PHP_SELF; ?>" method="post"><?                    
//Open all the items
           echo"
                                   <div class='item'>
                                       <div class='element'>{$row_products['name']}</div>
                                       <div class='element'>00/00/00</div>
                                       <div class='elementprimtool'>";?>
<input type="image" name="delete"
 src="images/delete.jpg"
 value="<?php echo $row_products['manufacturer_id'] ?>" />
<?
Go to the top of the page
 
+Quote Post
rvalkass
post Sep 3 2005, 07:57 AM
Post #2


apt-get moo
Group Icon

Group: [MODERATOR]
Posts: 2,153
Joined: 28-May 05
From: Devon, England
Member No.: 7,593
Spam Patrol



OK, try changing it so that it is all on one line, e.g.

CODE

<input type="image" name="delete" src="images/delete.jpg" value="<?php echo $row_products['manufacturer_id'] ?>" />


You could also try changing the closing tag, so you don't have a slash. Sometimes it can cause problems. I think you also need a ; after that PHP you have in the value attribute.

CODE

<input type="image" name="delete" src="images/delete.jpg" value="<?php echo $row_products['manufacturer_id']; ?>">


Tell us if that helps.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Many Php Script Sites(16)
  2. Script: Php Jukebox(4)
  3. Increment A Mysql Column(7)
  4. Parse: Error Unexpected T_lnumber(4)
  5. Can You Add Images Into A Mysql Database?(20)
  6. Subquery In Mysql(5)
  7. Creating Profiles In Php/mysql ?(7)
  8. Watermark Your Image With Simple Php Script(35)
  9. Free Auction Script(6)
  10. What Kind Of Script Do You Need ?(15)
  11. Creatting A Playlist Through Php(5)
  12. Very Simple Online Now Script(4)
  13. Html Code Tester. Online Script(15)
  14. Mysql Won't Update(4)
  15. Php Downloads Script(4)
  1. Script Help Required: Undefined Variable(3)
  2. Tools Needed!(9)
  3. Need Help Installing Dolphin Community Script!(5)
  4. Ms-access Database Question(3)
  5. Php And Mysql Programming(2)
  6. Best Php And Mysql Editor For Noobs(6)
  7. Html Form!(4)
  8. Mysql Error(3)
  9. Create Table - Mysql Code - Help(1)
  10. Guessing Php Script(2)
  11. How To Make A View New Post Script?(5)
  12. Php Guest Online Script(3)
  13. How To Make Php Newsletter Script(3)


 



- Lo-Fi Version Time is now: 11th October 2008 - 04:30 AM