PhilipG Posted November 12, 2009 Share Posted November 12, 2009 (edited) I've been trying to recall something through a sqlite query. It's supposed to return the results in a array! My code: func update($i) Local $Query, $Row, $iRows, $iColumns $Query = "SELECT * FROM uppdrag WHERE id=" & $i & " limit 1;";kollar uppdragets id _SQLite_GetTable ($dbn, $Query, $Row, $iRows, $iColumns); lagrar uppdragets id i $row['id'] $updateradio= "$radio" & $Row['typ'] GUICtrlSetData ($idinfo, $Row['id']) GUICtrlSetData ($uppdrag, $Row['uppdrag']) GUICtrlSetData ($kontaktperson, $Row['kontaktperson']) GUICtrlSetData ($tel1, $Row['tel1']) EndFunc The new field values does change. But now all of them shows 42 (It may be the meaning of life, but it is not the correct result of the query) I've done some research and from what i can understand the $row array only returns values if you format like this $row[1], $row[2]! My question is: Have i done anything wrong? Or is it even possible to return answers in the way i'm trying to describe(like they are return in mysql queries in php, $array['fieldname'] = "correct result on the given database fieldname")? This is still my first script so i am no expert! EDIT: Some spelling Edited November 12, 2009 by PhilipG Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 12, 2009 Share Posted November 12, 2009 (edited) That's basic AutoIt syntax for arrays. All indexes are integers. AutoIt does not have "associative arrays" that could be referenced with string values. You might want to spend some time reading the help file and trying out some of the functions (example scripts are included). Then there some basic tutorials in the help file and the AutoIt 1-2-3 tutorial linked in my sig. P.S. One thing you could do is use _ArrayDisplay() to see what the returned $Row array looks like. That might help you pick out what indexes you wanted. Edited November 12, 2009 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted November 12, 2009 Share Posted November 12, 2009 If you have problems with arrays there are also a good tutorial about that in the wiki. Link .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
PhilipG Posted November 13, 2009 Author Share Posted November 13, 2009 I've solved the problem by writing a function for it you can close the thread 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