repeat with

liamlambert liamlambert at mac.com
Fri Jan 13 15:45:46 EST 2006


I have not set the itemDel

on fSave
   global gConID

   if fld "total" is empty then
     answer error "THERE IS NO TOTAL" as sheet exit to top
   end if

   put  
"name1,phone,child,adult,total,credit,paymenttype,address,address1,addre 
ss2,email,seatNo,ticket,showID" into tFieldNames
   repeat for each item tField in tFieldNames
     put "'" & cleanSQL (field tField) & "'" & "," after tRowData
   end repeat


   put "INSERT INTO showDb 
(userID,name,phone,child,adult,total,credit,paymenttype,address,address1 
,address2,email,seatNo,ticket,showID)" & \
       " VALUES(null," & tRowData & ")" into tSQL

   put revdb_execute(gConID,tSQL) into tTmp


   put empty into fld "name1"
   put empty into fld "phone"
   put empty into fld "child"
   put empty into fld "adult"
   put empty into fld "total"
   put empty into fld "credit"
   put empty into fld "address"
   put empty into fld "address1"
   put empty into fld "address2"
   put empty into fld "email"

   put empty into fld "childprice"
   put empty into fld "adultprice"


   ----->refresh
   get fld "showid"
   put it into tshowid
   put "SELECT  
userid,name,phone,child,adult,total,credit,paymenttype,seatNo,ticket,sho 
wid FROM showDb WHERE showid = '" & tshowid & "'" into tSQL
   --> EXECUTE SQL
   put revdb_querylist(,,gConID,tSQL) into tList
   put tList into fld "list"
end fsave



function cleanSQL pSQL
   --> THIS ESCAPES THE QUOTE PROBLEM IN SQL
   replace "'" with "''" in pSQL
   replace quote with quote & quote in pSQL
   --> THIS ESCAPES THE tab AND cr DELIMITERS
   --> IF YOU PLAN ON HAVING USERS ENTER cr AND tab THEN YOU ALSO  
NEED TO
   -->    replace "*CR*" with cr IN THE RETURNED DATA!
   replace cr with "*CR*" in pSQL
   replace tab with "*TAB*" in pSQL
   return pSQL
end cleanSQL

Liam Lambert
liamlambert at mac.com
IRELAND





More information about the use-livecode mailing list