Hello I am accessing and manipulating a mysql DB based on this tutorial
http://lessons.livecode.com/m/4071/l/70 ... l-database
This is how I have been adding records
on mouseUp
-- check the global connection ID to make sure we have a database connection
global gConnectionID
if gConnectionID is not a number then
answer error "Please connect to the database first."
exit to top
end if
-- edit these variables to match your database & table
-- this assumes a table called Table1 with 3 fields
put "Table1" into tTableName
put "INSERT INTO " & tTableName & " (" & tFields & ") VALUES (:1)" into tSQL
-- send the SQL to the database, filling in the placeholders with data from variables
revExecuteSQL gConnectionID, tSQL, "tFirstName", "tLastName", "tBirthDate"
-- check the result and display the data or an error message
if the result is a number then
answer info "New record added."
else
answer error "There was a problem adding the record to the database:" & cr & the result
end if
end mouseUp
I would like to replace for edit the record instead of adding a new one.
Any suggestions would be great
Replace or delete then insert into
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Replace or delete then insert into
Hi Jordy,
"update" is the SQL command you are looking for:
http://www.w3schools.com/sql/sql_update.asp
Best
Klaus
"update" is the SQL command you are looking for:
http://www.w3schools.com/sql/sql_update.asp
Best
Klaus
Re: Replace or delete then insert into
thats the help I needed thanks