How NOT to Code - Example 1
I recently gave a presentation to our local ColdFusion group titled 'How NOT to Code in ColdFusion' where I showed simple mistakes that I run across. I figured this might make an interesting series of posts on my blog as well. So here's the first example. The game is to find as many mistakes with the code as possible, and yes, there will always be several to pull out of them. Naturally you may want to see how many you can find before scrolling down for the comments where people give their answers. As far as style type issues I'm not as concern with them per se, but you're free to list them if you like. I'll probably bounce around with languages like AS3, Flex, CFML and AJAX - so hopefully people will find this fun.
<cfquery datasource="#sysdb#" name="adduser">
insert into users(firstname,mi,lastname,email)
<cfquery datasource="#sysdb#" name="id">
select max(id) as newid from users where 0=0
<cfset session.id = id.newid/>