SQL table fields access

Post Reply
wtian
Posts: 11
Joined: Thu Apr 05, 2001 3:23 pm

SQL table fields access

Post by wtian »

I am trying to find info about access result from SQL command. I would like to access field name/value from a command like

<SQL "select * from mytable>
<iterate through fields and process values >
</SQL>

If that is not possible, I want to know if I can access fields that I have names in my variable. Like:

<$myfields =F1 F2 F3>
<construct $mysql as "select F1,F2,F3 from mytable">
<SQL $mysql>
<LOOP $myfields>
<??? display value of field with name $myfields>
</LOOP>
</SQL>

All these are not possible, I assume that I had to use a user function to do this. Can someone tell me something(insight,suggestion,etc) about this approach?

Thanks in advance.

Yes, I am new to this and we have full texis license.
wtian
Posts: 11
Joined: Thu Apr 05, 2001 3:23 pm

SQL table fields access

Post by wtian »

I figured.

If I have a dummy function

<a name = dummy>
<$F1>
<$F2>
<$F3>
</a>


Then I can use the second approach:


<$myfields =F1 F2 F3>
<construct $mysql as "select F1,F2,F3 from mytable">
<SQL $mysql>
<LOOP $myfields>
<getvar $myfields>
<... do what ever to $ret ...>
</LOOP>
</SQL>


In this case, I do need have that dummy function that contains all my table column name that I may need to access.

This will help. But is there any solution to access values returned by "select * from mytable"?
I saw examples of this kind in documents which led me to think we can access values more than a row number count.

Cheers.
User avatar
mark
Site Admin
Posts: 5514
Joined: Tue Apr 25, 2000 6:56 pm

SQL table fields access

Post by mark »

Post Reply