Insert into when a page loads
Hello So I have a page and when it loads I would like to have it insert into a table if a record is matched. In the body I have this:
<cfquery name="countlookup" Datasource="#application.datasource#" dbtype="ODBC">
SELECT id as idlx
FROM usercount
</cfquery>
<cfset idl = #countlookup.idlx#>
<cfif #idl# eq '449'>
<cfquery name="countlookup450" Datasource="#application.datasource#" dbtype="ODBC">
INSERT INTO usercount (id)
values (450)
</cfquery></cfif>
Issue I'm seeing is the page loads and doesn't insert anything in the usercount table. What am I messing up? I'm using Coldfusion 2021 woth SQL 2019.
Thanks
