Hiutaky Posted December 29, 2013 Posted December 29, 2013 Hi all , i'm using mysql.au3 UDF to make a script . Now , when i'm adding value on the database it's all ok , but , when i search in it i don't recive the success value. Here the code : Global $_conn = _MySQLConnect($_sql_user, $_sql_pass, $_sql_db, $_sql_server) $_r_p_query = ("SELECT Points FROM User_Points WHERE ID=1") $_res = _Query($_conn, $_r_p_query) MsgBox(0, "asd", $_res) if i execute this query : SELECT Points FROM User_Points WHERE ID=1 on navicat i get the value. Thx
jchd Posted December 29, 2013 Posted December 29, 2013 Post your schema and the code you use for insert(s). This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
MHz Posted December 30, 2013 Posted December 30, 2013 If mysql.udf is the udf created by cdkid >here then I may expect $_res to be a COM object. If so, then examples exist in that topic of how to access info from the COM object.
Hiutaky Posted December 30, 2013 Author Posted December 30, 2013 Post your schema and the code you use for insert(s). To insert data into database i use this : ("INSERT INTO `User` VALUES ('" & $_r_record & "', '" & $_g_username[0] & "', '" & $_g_name[0] & "'); This is the DB Schema :
jchd Posted December 30, 2013 Posted December 30, 2013 The result of a query is an array. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
Hiutaky Posted December 30, 2013 Author Posted December 30, 2013 I tried , but it gave me error : "C:\Users\hiutaky\Desktop\AUTOIT\AskLike\testsql.au3" (19) : ==> Subscript used on non-accessible variable.: MsgBox(0, "asd", $_res[0]) MsgBox(0, "asd", $_res^ ERROR
Hiutaky Posted December 30, 2013 Author Posted December 30, 2013 #cs Function name: _Query Description: Send a query to the database Parameter(s): $oConnectionObj - As returned by _MySQLConnect. $query - The query to execute Return Value(s):On success returns the query result. On failure returns 0 and sets @error to 1 Requirement(s):Autoit3 with COM support Author(s): cdid #ce
jchd Posted December 30, 2013 Posted December 30, 2013 (edited) Then I run out of ideas from where I sit. EDIT: oops, I'm so much used to higher-level functions that I overlook the need for walking thru the resultset! Edited December 31, 2013 by jchd This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
kylomas Posted December 30, 2013 Posted December 30, 2013 Hiutaky, This is directly out of the thread that MHz pointed you to... $sql = _MySQLConnect("sa", "sa", "mydb", "mywebsite.com") $var = _Query($sql, "SELECT * FROM mytable WHERE user = 'username'") With $var While Not .EOF FileWriteLine("c:\test.txt", .Fields("user_name").value & @CRLF) .MoveNext WEnd EndWith _MySQLEnd($sql) Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Hiutaky Posted December 30, 2013 Author Posted December 30, 2013 Solved , i got the value by database , but now , it gave me this error : "C:UsershiutakyDesktopAUTOITAskLiketastsql3.au3" (16) : ==> Only Object-type variables allowed in a "With" statement.: With $TableContents With ^ ERROR
jchd Posted December 30, 2013 Posted December 30, 2013 Add error checking. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
jdelaney Posted December 30, 2013 Posted December 30, 2013 If IsObj($TableContents) Then With $TableContents EndWith EndIf IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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