Jump to content

[SOLVED] MySQL: how to update record?


Recommended Posts

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
Link to comment
Share on other sites

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)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...