[thelist] php/mySQL update problem

Nemesis nemesis at nemesis1.f2o.org
Sat Aug 23 21:40:14 CDT 2003


Tom Dell'Aringa wrote:

> --- 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"
> 

It should work once you removed the quotes. Notice something missing?
   articleID = $aid"; <------- or is it a typo?

Gary

-- 
The Nemesis Project
http://nemesis1.f2o.org
One Stop CSS



More information about the thelist mailing list