home *** CD-ROM | disk | FTP | other *** search
/ Cool Page Magazine 16 / CoolPage_16.iso / dynadb / codes / addnew2.cfm < prev    next >
Text File  |  1997-12-03  |  3KB  |  103 lines

  1. <!---------------------------└╔ªWíGAddnew2.cfm--------------------->
  2. <!---            │o¼Oñ@¡╙½ß│B▓z╡{ªí            --->
  3. <!---        Ñ╗¡╢¼Oªb┐ΘñJ╝╞¡╚ÑH½ß│B▓z¬║╣L╡{            --->        
  4. <!---        ½e¡▒ñjÑb│í│ú¼Oªb┤·╕╒⌐╥┐ΘñJ¬║╕Ω«╞¼Oº_Ñ┐╜T    --->
  5. <!----------------------------------------------------------------->
  6. <HEAD><TITLE>╖s╝W╕Ω«╞</TITLE></HEAD>
  7. <BODY background="paper12l.jpg">
  8. <HTML>
  9.  
  10.  
  11.  
  12.     <!--- ▒N┼▄╝╞▒╥⌐lñ╞  --->
  13.  
  14.     <cfset iserror=false>        <!--- ¿M⌐wª│¿Sª│┐∙╗~╡oÑ═¬║┼▄╝╞        --->
  15.     <cfset dupidx=false>        <!--- ¿M⌐w│f¬½╜s╕╣ª│¿Sª│¡½┬╨¬║┼▄╝╞    --->
  16.     <cfset id_long=false>        <!--- ¿M⌐w│f¬½╜s╕╣ª│¿Sª│╣L¬°¬║┼▄╝╞    --->
  17.     <cfset name_long=false>        <!--- ¿M⌐w│f¬½ªW║┘ª│¿Sª│╣L¬°¬║┼▄╝╞    --->
  18.     <cfset out_id="">
  19.     <cfset out_name="">
  20.     <cfset out_quantity=0>
  21.     <cfset out_cost=0>
  22.     <cfset out_ftype=''>
  23.  
  24.     <!--- └╦¼d│f¬½╜s╕╣ª│¿Sª│¡½╜╞ --->
  25.     <CFQUERY NAME="Checkidx" DATASOURCE="Dynamic Database">    
  26.         select * from product where prod_id = '#prod_id#'
  27.     </CFQUERY>
  28.  
  29.     <cfif #Checkidx.recordcount# greater than 0>
  30.         <!--- ªp¬G╝╞╛┌¬φñññwª│░O┐²íA½h╢╟ª^ #Checkidx.recordcount# ¼░ 1, 
  31.         ¿Sª│░O┐²½h╢╟ª^ 0íAª]¼░ñ@¡╙ prod_id Ñu»αª│ñ@¡╙░O┐²           --->
  32.  
  33.         <cfset iserror=true>
  34.         <cfset dupidx=true>            
  35.     <cfelse>
  36.         <cfset out_id=#prod_id#>
  37.         <cfset out_quantity=#quantity#>
  38.         <cfset out_cost=#cost#>
  39.     </cfif>
  40.  
  41.     <cfif len(#prod_id#) greater than 10>
  42.     <!--- └╦¼d┐ΘñJ─µª∞¬║ñσªr¼Oº_╣L¬°    --->
  43.         <cfset iserror=true>
  44.         <cfset id_long = true>
  45.     <cfelse>            
  46.         <cfset id_long =false>
  47.         <cfset out_id=#prod_id#>
  48.  
  49.     </cfif>
  50.  
  51.     <cfif len(#product_name#) greater than 30>
  52.     <!--- └╦¼d┐ΘñJ─µª∞¬║ñσªr¼Oº_╣L¬°    --->
  53.         <cfset iserror=true>
  54.         <cfset name_long = true>
  55.     <cfelse>            
  56.         <cfset name_long =false>
  57.         <cfset out_name=#product_name#>
  58.     </cfif>
  59.  
  60.     <cfif iserror>
  61.         ┐ΘñJñúÑ┐╜TíCºAÑ╟ñFÑHñU┐∙╗~íG<br>
  62.  
  63.         <cfif id_long>
  64.             │f¬½╜s╕╣ñ╙¬°íC╜╨ñ┼┐ΘñJ╢W╣L 10 ¡╙ªrª∞¬║╜s╕╣íC<br>
  65.         </cfif>
  66.  
  67.         <cfif name_long>
  68.             │f¬½ªW║┘ñ╙¬°íC╜╨ñ┼┐ΘñJ╢W╣L 30 ¡╙ªrª∞¬║│f¬½ªW║┘íC<br>
  69.         </cfif>        
  70.  
  71.         <cfif dupidx>
  72.             │f¬½╜s╕╣¡½╜╞<br>
  73.         </cfif>
  74.     <cfelse>
  75.         <!---    ªp¬G│q╣LñF⌐╥ª│¬║┤·╕╒íA┤N╖|¿╙¿∞│oñ@│íñ└    --->
  76.         <CFQUERY NAME="GetType" DATASOURCE="Dynamic Database">    
  77.             select * from prodtype where type_name = '#type#'
  78.         </CFQUERY>
  79.  
  80.         <cfoutput query="GetType">
  81.             <cfset out_type='#type_code#'>
  82.         </cfoutput>
  83.  
  84.         
  85.         <!------------------------------------------------------------------------->
  86.         <!---    ÑHñU│oñ@¼q¼O╝╨╖╟¬║ SQL Ñy¬kíAÑ╬ÑH╖s╝Wñ@¡╙░O┐²íC            --->
  87.         <!---    Ñy¬k¼░ insert into [table name] (fieldname1, fieldname2...)    --->
  88.         <!---        values (field1_value, field2_value...)            --->
  89.         <!------------------------------------------------------------------------->
  90.         
  91.         <CfQuery name="AddRecord" datasource="dynamic database">
  92.             insert into product (prod_id, product_name, quantity, cost, type)
  93.             values ('#out_id#', '#out_name#', #out_quantity#, #out_cost#, '#out_type#')
  94.         </cfquery>
  95.  
  96.         <!-------------------------SQL¬║Ñy¬k¿∞│o╕╠╡▓º⌠----------------------------->
  97.         <CENTER><H2>ºA¡Φñ~⌐╥┐ΘñJ¬║╕Ω«╞ñw╖s╝Wª▄╝╞╛┌«wññ</H2></CENTER>
  98.         <HR>
  99.         <P ALIGN="center"><A HREF="/dynadb/index.htm">ª^¿∞ÑD¡╢</A></P>
  100.     </cfif>
  101.  
  102. </BODY>
  103. </HTML>