evo14sale
asked on
easy points,editing tables value,and access database
hi ya
i have the following data, i would like the user to be able to change the carstatus in the table which will also update the database,can someone plz show me how to do it.
it doesnt matter how its done,either by radio buttons,text etc
<CFQUERY NAME="CarQuery" DATASOURCE="../dno/ser3">
SELECT * FROM Cars
</CFQUERY>
<TABLE border="2" >
<TR>
<TH> Car ID </HT>
<TH> Car_Status </HT>
</TR>
<CFOUTPUT QUERY="CarQuery">
<TR align="left">
<TD>#CarQuery.CarID#</TD>
<TD>#CarQuery.Car_Status#< /TD>
</TR>
</CFOUTPUT>
</table>
i have the following data, i would like the user to be able to change the carstatus in the table which will also update the database,can someone plz show me how to do it.
it doesnt matter how its done,either by radio buttons,text etc
<CFQUERY NAME="CarQuery" DATASOURCE="../dno/ser3">
SELECT * FROM Cars
</CFQUERY>
<TABLE border="2" >
<TR>
<TH> Car ID </HT>
<TH> Car_Status </HT>
</TR>
<CFOUTPUT QUERY="CarQuery">
<TR align="left">
<TD>#CarQuery.CarID#</TD>
<TD>#CarQuery.Car_Status#<
</TR>
</CFOUTPUT>
</table>
ASKER
YEH THAT WAS ME,I JUST NEVA GOT NE REPLYS,WELL IF IT WORKS,ILL GIVE U BOTH POINTS IF U SAY THE RIGHT ANSWER
ASKER
can u plz show me how to have a couple of radio buttons,so when i click on one,it will update the database.
ps i dont know wat u mean with this,wat is cfqueryparam?
<CFIF ISDEFINED('CARSTATUS') & LEN(TRIM(CARSTATUS))>
<CFQUERY NAME="Qry_Update" DATASOURCE="Dsn">
Update mytable
set carstatus = <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar" VALUE="#carstatus#">
where carid = <CFQUERYPARAM CFSQLTYPE="cf_sql_numeric" VALUE="#carid#">
</CFQUERY>
</CFIF>
ps i dont know wat u mean with this,wat is cfqueryparam?
<CFIF ISDEFINED('CARSTATUS') & LEN(TRIM(CARSTATUS))>
<CFQUERY NAME="Qry_Update" DATASOURCE="Dsn">
Update mytable
set carstatus = <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar"
where carid = <CFQUERYPARAM CFSQLTYPE="cf_sql_numeric"
</CFQUERY>
</CFIF>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> <cfqueryparam> actually makes queries more secure, and, sometimes faster.
Chris is right. Use Query/Bind Params. Most DBs are setup for statement caching. If you don't use Bind Params, each query with a different value will come in as a new query. If you use Bind Params each value is used and the statement/query is retreived from the DB cache.
CJ
Chris is right. Use Query/Bind Params. Most DBs are setup for statement caching. If you don't use Bind Params, each query with a different value will come in as a new query. If you use Bind Params each value is used and the statement/query is retreived from the DB cache.
CJ
<CFQUERY NAME="CarQuery" DATASOURCE="../dno/ser3">
SELECT * FROM Cars
</CFQUERY>
<TABLE BORDER="2" >
<FORM NAME="frm" ACTION="updatestatus.cfm" METHOD="post">
<TR>
<TH> Car ID </HT>
<TH> Car_Status </HT>
</TR>
<CFOUTPUT QUERY="CarQuery">
<TR ALIGN="left">
<TD>#CarQuery.CarID#<INPUT
<TD><INPUT NAME="carstatus" VALUE="#CarQuery.Car_Statu
</TR>
</CFOUTPUT>
</FORM>
</TABLE>
<!--- updatestatus.cfm --->
<CFIF ISDEFINED('CARSTATUS') & LEN(TRIM(CARSTATUS))>
<CFQUERY NAME="Qry_Update" DATASOURCE="Dsn">
Update mytable
set carstatus = <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar"
where carid = <CFQUERYPARAM CFSQLTYPE="cf_sql_numeric"
</CFQUERY>
</CFIF>
<CFLOCATION URL="updatedone.htm" ADDTOKEN="No">
HTH
K'Rgds
Anand
PS : I wonder - the same question was asked by someone ... else ?????????????