Jump to content

Recommended Posts

Posted

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 :D

Posted

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 here
RegExp tutorial: enough to get started
PCRE 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)

Posted

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. :)

Posted

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 :

Untitled.png

Posted

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 here
RegExp tutorial: enough to get started
PCRE 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)

Posted

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
Posted

#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

Posted (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 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 here
RegExp tutorial: enough to get started
PCRE 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)

Posted

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

Posted

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

Posted

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 here
RegExp tutorial: enough to get started
PCRE 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)

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
  • Recently Browsing   0 members

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