putting binary data into a mySQL database

John Dixon dixonja at hotmail.co.uk
Thu Jan 21 09:51:09 EST 2016


Can someone tell me what I am doing wrong here ? I am not able to insert data into the table 'thenamer'..
When the script runs nothing is returned in whathappened, 

the table name is thenamer
the fields in the table are idNo, thename, thechat

I know that the .lc script works without trying to insert anything into the database, as I can get it to return to me the contents of the variable thestuff as shown in the second .lc script below

Any help, pointers, whisky glady accepted... as I'm losing hair...:-)

<?lc
put $_GET["A"] into tAction
    
   get revOpenDatabase("mysql", "localhost", "xxxxxxxx", "xxxxxxx", "xxxxxxx")
   put it into theDataRef
   
 if tAction = "request" then    
   put $_GET["boodata"] into thestuff
   
   put "thenamer" into tTableName
   put "thename, thechat" into tFields
   put "John" into thename
   put thestuff into thechat
   
   put "INSERT INTO" & tTableName & "(" & tFields & ") VALUES(:1,:2)" into tSQL
   revExecuteSQL theDataRef, tSQL, "thename","theChat"
   put the result into whathappened
   
   put whathappened
   revCloseDataBase theDataRef    

   quit    
  end if    
?>    

The .lc script behaves when not trying to insert data into the database...

<?lc
put $_GET["A"] into tAction
    
   get revOpenDatabase("mysql", "localhost", "xxxxxxxx", "xxxxxxxx", "xxxxxxxx")
   put it into theDataRef
   
 if tAction = "request" then    
   put $_GET["boodata"] into thestuff
   
   
   
   put thestuff    
   revCloseDataBase theDataRef    

   quit    
  end if    
?>    



 Date: Thu, 21 Jan 2016 12:22:58 +0000
> From: neil at livecode.com
> To: use-livecode at lists.runrev.com
> Subject: Re: putting binary data into a mySQL database
> 
> Hi John,
> 
> You should be able to use the URLEncode  when passing it to the .lc 
> script and then URLdecode to decoded it back to it original form.
> 
> Kind Regards,
> 
> Neil
> 
> 
> 	
> 
> LiveCode Technical Support and Content Creation Lead
> neil at livecode.com <mailto:neil at livecode.com>
> 
> LiveCode
> +44 (0) 845 219 8923.
> 25A Thistle Street Lane South West, Edinburgh, EH2 1EW
> http://www.livecode.com
> 
> Facebook <https://www.facebook.com/pages/LiveCode/121318328010780> 
> Twitter <https://twitter.com/livecode> Youtube 
> <https://www.youtube.com/user/RunRevLtd> Linkedin 
> <https://github.com/runrev/livecode>
> 
> 
> On 21/01/2016 12:10, John Dixon wrote:
> > Thanks for the reply.. :-)
> >
> > I though have another question, How do I pass encrypted data to an .lc script ?
> >
> >
> >> Date: Thu, 21 Jan 2016 19:30:09 +0800
> >> Subject: Re: putting binary data into a mySQL database
> >> From: lan.kc.macmail at gmail.com
> >> To: use-livecode at lists.runrev.com
> >>
> >> Look up revExecuteSQL in the Dictionary. Of particular interest:
> >>
> >> To pass binary data in a variable in the variablesList, prepend "*b" to the
> >>> variable name. The *revExecuteSQL* command strips the binary marker "*b"
> >>> and passes it to the database as binary data, rather than text data.
> >>
> >> Basically you need to be using the variable list form of revExecuteSQL
> >> rather than passing the data directly. Also there is a note about binary in
> >> arrays that are being loaded into dbs.
> >> _______________________________________________
> >> use-livecode mailing list
> >> use-livecode at lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >   		 	   		
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
 		 	   		  


More information about the use-livecode mailing list