BillLuvsU Posted November 17, 2010 Share Posted November 17, 2010 So I've spent the evening looking into the several MySQL UDFs across the forum, trying to understand how to use them, and I have failed horribly. Does anoybody know a good place to start? I'm just trying to do simple data storage and am only using the database at all for cross language compatibility. Why cant there just be a simple function like SendToDB( $value, $row, $cloumn, $table ) GetFromDB( $value, $row, $cloumn, $table ) All help appreciated . [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw Link to comment Share on other sites More sharing options...
James Posted November 17, 2010 Share Posted November 17, 2010 Why cant there just be a simple function likeThere can be, you just need to allow for circumstances where the programmer does not require adding in optional clauses.I've written PHP functions like this before, so I'll post the code when I get home. All you need to do is convert to AutoIt James Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Zedna Posted November 17, 2010 Share Posted November 17, 2010 (edited) For this simple DB purpose I recommend to use SQLite.It's part of AutoIt and there are easy functions for working with DB data, see this example from Autoit's helppfile:Good SQL help is here http://www.w3schools.com/sql/default.aspexpandcollapse popup#include <SQLite.au3> #include <SQLite.dll.au3> Local $aResult, $iRows, $iColumns, $iRval _SQLite_Startup () If @error > 0 Then MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!") Exit - 1 EndIf _SQLite_Open () ; Open a :memory: database If @error > 0 Then MsgBox(16, "SQLite Error", "Can't Load Database!") Exit - 1 EndIf ;Example Table ; Name | Age ; ----------------------- ; Alice | 43 ; Bob | 28 ; Cindy | 21 If Not _SQLite_Exec (-1, "CREATE TEMP TABLE persons (Name, Age);") = $SQLITE_OK Then _ MsgBox(16, "SQLite Error", _SQLite_ErrMsg ()) If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Alice','43');") = $SQLITE_OK Then _ MsgBox(16, "SQLite Error", _SQLite_ErrMsg ()) If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Bob','28');") = $SQLITE_OK Then _ MsgBox(16, "SQLite Error", _SQLite_ErrMsg ()) If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Cindy','21');") = $SQLITE_OK Then _ MsgBox(16, "SQLite Error", _SQLite_ErrMsg ()) ; Query $iRval = _SQLite_GetTable2d (-1, "SELECT * FROM persons;", $aResult, $iRows, $iColumns) If $iRval = $SQLITE_OK Then _SQLite_Display2DResult($aResult) ;~ $aResult looks like this: ;~ ;~ Name Age ;~ Alice 43 ;~ Bob 28 ;~ Cindy 21 ;~ ;~ If the dimensions would be switched in _SQLite_GetTable2d the result would look like this: ;~ ;~ Name Alice Bob Cindy ;~ Age 43 28 21 Else MsgBox(16, "SQLite Error: " $iRval, _SQLite_ErrMsg ()) EndIf _SQLite_Close () _SQLite_Shutdown () Edited November 17, 2010 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
russell Posted November 19, 2010 Share Posted November 19, 2010 Im in the same boat, tried looking up using MySQL in autoit and it seems you need several addictional files and there is a big lack of help i.e. no helpfile or thread dead. Im just trying to have my 1500+ line script read a vaule from my webpages database. muppet hands are so soft :) Link to comment Share on other sites More sharing options...
condoman Posted November 19, 2010 Share Posted November 19, 2010 I have used SQLite also and found it easy and fast. I also use the SQLite Manager add-on in Firefox to manipulate the DB without having to code the changes I want. Link to comment Share on other sites More sharing options...
russell Posted November 19, 2010 Share Posted November 19, 2010 SQLLite only does local i think. muppet hands are so soft :) Link to comment Share on other sites More sharing options...
BillLuvsU Posted November 20, 2010 Author Share Posted November 20, 2010 Hey guys, SqLite doesn't fit my purpose as it's local only. However I finally managed to figure out the mysql syntax. Thanks for the link zedna, it cleared alot of the fog from my eyes. @russel You interact with the mysql database through querys, which are like commands. Then you use another function to pull the result (depending on which UDF your using). [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now