Thanks. I must apology as I made a mistake when writing the incoming
variable's name. I had it wrong so it would pass the variable but the
incoming script was looking for a variable that wasn't passed. In the
meantime, and now that I correct that, I'm still comparing artid to
'$artid' (with single quotes) and it does it well... it is an int(4)
field and now that you mention it... how is it possible?
C.
-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 14, 2002 12:47 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] Re: Trying to delete
In article 01c2433c$e2e3e4c0$e5c405c8@gateway,
[EMAIL PROTECTED]
says...
Hi all.
I have a small problem here. I have this full-PHP site working with
a
MySQL db and came to a dead road when trying to delete a record from
it
from the Administrator's page. I have PHP to make this decision
after
the Administrator selected the record to delete and answered YES to
the
=BFAre you sure...? The last part will pass a hidden value of
$editpic
which tells the deleting script which artid to delete from the db.
This
is the code that does the deletion:
else if ($deleteyes)
{
$query =3D DELETE FROM saav_arts WHERE artid =3D '$editpic'
LIMIT
1;
$result =3D mysql_query($query) or die (mysql_error());
if (!$result)
{
echo The Picture could NOT be deletedbr;
echo form action=3D\.$PHP_SELF.\
method=3D\post\;
echo input type=3D\submit\ name=3D\cancel\
value=3D\Back to Edition\;
echo /form;
}
else if ($result)
{
echo The Picture was deleted sucsesfullybr;
echo form action=3D\.$PHP_SELF.\
method=3D\post\;
echo input type=3D\submit\ name=3D\cancel\
value=3D\Back to Edition\;
echo /form;
}
}
Cesar Aracena
CE / MCSE+I
You have made some wrong assumptions in your code here; it is quite
possible that $result may be true but no entries have been deleted.
You
perhaps should look at the possibility of testing mysql_affected_rows
to
determine whether any rows have been updated/deleted.
WHERE artid = '$editpic'
implies that you expect artd to be a text field of type char or
varchar because you have enclosed the value that you are testing in
single
quotes; if artid is in fact an integer type, this query will not
affect
any rows, as the text value will never match an integer field value.
--
David Robley
Temporary Kiwi!
Quod subigo farinam
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php