Jump to content
Sign in to follow this  
michaelslamet

[SOLVED] MySQL: how to update record?

Recommended Posts

michaelslamet

Could anybody please give an example how to update record using MySQL UDF?

Looking around and seems cant find anything about this :(

Local $SQLCode, $TableContents = ""

$SQLInstance = _MySQLConnect($sUserName,$sPassword,$sDatabase,$sServerName)
$SQLCode = "UPDATE mytable SET Price='430' WHERE ProductID='BEX01'"
$TableContents = _Query ($SQLInstance, $SQLCode)
With $TableContents
     While NOT .EOF
         .MoveNext
     WEnd
EndWith
_MySQLEnd($SQLInstance)

This code seems so wrong because after While NOT .EOF it does nothing :-D

Thanks in Advance :)

Edited by michaelslamet

Share this post


Link to post
Share on other sites
michaelslamet

Found the solution myself. I connect to the database using a privillege that read-only so i cant write/update to the database :(

This code works:

Local $SQLCode, $TableContents = ""

$SQLInstance = _MySQLConnect($sUserName,$sPassword,$sDatabase,$sServerName)
$SQLCode = "UPDATE mytable SET Price='430' WHERE ProductID='BEX01'"
$TableContents = _Query ($SQLInstance, $SQLCode)
_MySQLEnd($SQLInstance)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×