query_sql to Array

joecalis

New member
Messages
21
Points
0
I was just wondering what the outcome will be if I do the following:


query_sql("SELECT * FROM `awesome_table` WHERE `ID`=1",.@tempvar$); 
awesome_table:

ID Name Val1   Val2   Val3

(int) (string) (int)   (int)   (int)

1   Hi 0 1 0

2   Hello   1 1 1


My question is, would it automatically store all the information in the row selected into the array like so:

.@tempvar$[0] = 1

.@tempvar$[1] = "Hi"

.@tempvar$[2] = 0

.@tempvar$[3] = 1

.@tempvar$[4] = 0

or would it only store the first value in the row?

also would it automatically store the "int" values as "string"?

Need reply fast please and thank you
default_biggrin.png


 
Last edited by a moderator:
no it wouldn't. if it would work it would be

.@tempvar$[0] = 1

.@tempvar$[1] = 2

you have to add more variables to the end.

query_sql("SELECT * FROM `awesome_table` WHERE `ID`=1", .@ID, .@Name$, .@val1, .@val2, .@val3);

.@ID[0] = 1; .@Name$[0] = Hi

.@ID[1] = 2; .@Name$[0] = Hello

basically you just put the columns (from after select, * = all) in the second part of the query_sql command

$ because it is a string not an integer

 
Last edited by a moderator:
no it wouldn't. if it would work it would be

.@tempvar$[0] = 1

.@tempvar$[1] = 2

you have to add more variables to the end.

query_sql("SELECT * FROM `awesome_table` WHERE `ID`=1", .@ID, .@Name$, .@val1, .@val2, .@val3);

.@ID[0] = 1; .@Name$[0] = Hi

.@ID[1] = 2; .@Name$[0] = Hello

basically you just put the columns (from after select, * = all) in the second part of the query_sql command

$ because it is a string not an integer
Thank you, just as I expected it would do that.

But now I have alot to do, because I have like 25 columns to copy.

 
Back
Top