On 06/30/2010 11:44 PM, yaron nahcum wrote:
1. It says that it is possible to use psuedo variables
in the query. How
is it done? I would like to make a query of the from username.
Just include them straight in the literal query:
sql_query("ca", "SELECT * FROM users WHERE username =
'$fU'",
"ra");
2. If I query the whole column how can I look for a
specific value? The
only way is to go over all the values with a loop?
Generally, you should not be _searching_ for specific values in query
results; you should just design your query to constrain for the
criteria you want.
If you specifically need to _iterate_, rather than _search_, over the
returned values, yes, you will need to use an array index, e.g.
sql_query("ca", "SELECT ...", "ra");
$var(idx) = $dbr(ra=>rows) - 1;
while($var(idx) >= 0) {
$(avp(s:rowset)[$var(idx)]) = $dbr(ra=>row[0,N]);
...
$var(idx) = $var(idx) + 1;
}
--
Alex Balashov - Principal
Evariste Systems LLC
1170 Peachtree Street
12th Floor, Suite 1200
Atlanta, GA 30309
Tel: +1-678-954-0670
Fax: +1-404-961-1892
Web:
http://www.evaristesys.com/