Jump to content
  • 0
Sign in to follow this  
joecalis

query_sql to Array

Question

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

Edited by joecalis

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

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

Edited by Sunzuki

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.