Re: Deleting a Record.

From: Rob (talon2lm_at_yahoo.com)
Date: 11/24/03


Date: Sun, 23 Nov 2003 21:09:31 -0700

Hi Jochen,

Here's the exact code I ran

</HEAD>
<BODY BGCOLOR=RED>
<?php

$link = mysql_connect("localhost");
if(! $link)
        die("Could not connect to MySQL");

$database = "PC_Store";
mysql_select_db($database)
        or die ("could not open $database: ".mysql_error() );

- error_reporting(E_ALL);

$sql = "DELETE FROM inventorydata VALUES('$ProductID')";

print $sql;

$result = mysql_query("DELETE FROM inventorydata

VALUES('$ProductID')");

var_dump($result);
var_dump(mysql_error());
var_dump(mysql_rows_affected());

?>
 <BR>
 Entry Deleted
 </FORM>
 <FORM METHOD=POST ACTION = "PC_Store1.php">
 <INPUT TYPE = "submit" VALUE ="Return To Main Menu">
 </FORM>

And here is the Exact output...

DELETE FROM inventorydata VALUES('40')bool(false) string(66) "You have an
error in your SQL syntax near 'VALUES('40')' at line 1"
Fatal error: Call to undefined function: mysql_rows_affected() in
c:\apache\htdocs\pcsdelpexein.php on line 23

I'm not sure what the syntax error is.... 40 is the product Id for the row I
want to delete.
The Fatal error is way beyond me....I appreciate your help!

Rob



Relevant Pages

  • Re: slightly OT. php5 breaks my hit-count....
    ... I just tested this exact code on php 5.2.5 and I didn't receive any error. ... i need some help from any of you who is current with php5. ... to compilr php4. ...
    (freebsd-questions)
  • Re: [PHP] Still problem with file reading
    ... Show us your exact code. ... Sometimes PHP will say the file is "not there" when what it REALLY ... the permissions model in Windows changes with every ...
    (php.general)
  • Re: Question
    ... Have a look at the HTML code in your browser - you'll see the exact code ... including all the PHP statements as you've typed it. ... If you don't have a web server running yet, ...
    (comp.lang.php)
  • OT-Javascript Question
    ... I have this exact code on a regular html file and it works fine, copy paste to php file, and it doesn't work. ...
    (php.general)