Jump to content
Sign in to follow this  
PhilipG

SQLite returns array?

Recommended Posts

PhilipG

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 by PhilipG

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
PhilipG

I've solved the problem by writing a function for it

you can close the thread

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.