Using a card to make modifications to database

Jan Schenkel janschenkel at yahoo.com
Wed Oct 5 00:32:19 EDT 2005


--- Fred Giannetto <fgiannet at hotmail.com> wrote:
> Here is a copy of my script.  The point is for users
> to enter data into the 
> card and the submit button have the data inserted
> into the database.  The 
> sql works when submitted directly into the database.
> 
> on mouseUp
>   put field "Name" into tName
>   put field "Team" into tTeam
>   put field "Position" into tPosition
>   put field "Rushing" into tRushing
>   put field "Receiving" into tReceiving
>   get revOpenDatabases("MYSQL", "localhost", "test",
> root, root1)
>   put it into tDatabaseID
>   answer tName, tTeam, tPosition, tRushing,
> tReceiving, tDatabaseID
>   revExecuteSQL tDatabaseID,"insert into
> test.nflstats(Name, Team, Position, 
> Rushing, Receiving) values(tName, tTeam, tPosition,
> tRushing, tReceiving)"
> end mouseUp
> 
> I have the tDatabaseID variable to make sure I am
> recording the Database ID
> 
> Thank you for your assistance, There will be a lot
> of progress once I get 
> past these elementary hurdles
> All best Always
> Fred
> 

Hi Fred,

The database functions will not check the queries for
te presence of variable names and fill in he data.
Here's a quick alternative, which uses the built-in
substitution scheme:
--
   revExecuteSQL tDatabaseID,"insert into
 test.nflstats(Name, Team, Position, 
 Rushing, Receiving) values(:1,:2,:3,:4,:5)", tName,
tTeam, tPosition,
 tRushing, tReceiving
--
See the docs for a full explanation.

Hope this helped,

Jan Schenkel.

Quartam - Tools for Revolution
<http://www.quartam.com>

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)


		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com



More information about the Use-livecode mailing list