[thelist] php/mySQL update problem
Tom Dell'Aringa
pixelmech at yahoo.com
Sat Aug 23 21:16:52 CDT 2003
--- rudy <rudy937 at rogers.com> wrote:
> your queries look fine except for the quotes around $aid
> it's numeric, right? i'm guessing, but these ids usually are
Correct, numeric (author ID)
> i absolutely hate the way mysql lets you get away with sloppy
> coding like
>
> WHERE articleid = '$aid'
>
> this should give a syntax error if articleid is numeric
See, I THOUGHT that was the case. So I tried without the single
quote, and now I get:
You have an error in your SQL syntax near '' at line 9
Here it is w/o quote:
$sql = "UPDATE article
SET
articleTitle = '$aTitle',
authorID = '$author',
dateModified = '$aDate',
article = '$aBody',
categoryID = '$aCat',
articleBlurb = '$aBlurb'
WHERE
articleID = $aid"
> the update is probably running, but not updating any row, because
> it can't find the right row with that WHERE clause
> then the select runs, and it can't find the row either
Makes sense...
Do i need a semicolon at the end or something? Running this in
phpMyAdmin directly - it works fine...
Tom
=====
http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: Premium Content Author / JavaScript / Every Friday!
http://www.maccaws.com/ :: Group Leader
[Making A Commercial Case for Adopting Web Standards]
"That's not art, that's just annoying." -- Squidward
More information about the thelist
mailing list