On 06/30/2010 11:44 PM, yaron nahcum wrote:
- 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");
- 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; }