[ic] Two sql questions

Mike Heins mikeh@minivend.com
Wed, 1 Nov 2000 20:13:10 -0500


Quoting Kaare Rasmussen (kar@webline.dk):
> Can I get something like this to work:
> 
> [query sql=select count(*) from addresstype]
> [seti rowsfound]
> [sql-param count]
> [/seti]
> [/query]                                                                      
> 
> I want to place the number of rows in the addresstype table in scratch 
> rowsfound.

If you:

	1. Have a SQL database
	2. Quote your query sql= parameter
	3. Use [sql-pos 0] to access the return value

then it will work. You can use this to test it, as I did:

[query sql="select count(*) from country" list=1]
[sql-pos 0] countries
[/query]

which gives:

	197 countries

> 
> Question 2:
> 
> How many rows will this construct read at a time?
> 
>      [query more=1 ml=10 list=1 sql="select * from address"]
>     [list]
>             [sql-code] [sql-param field]<BR>
>     [/list]<BR>
>     [more-list]
>     [more]
>     [/more-list]
>     [/query]
> 

It will select all of them. It would make sense to use a "limit"
parameter if your DB supports it.

-- 
Akopia, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <heins@akopia.com>

Any man who is under 30, and is not liberal, has not heart; and any man
who is over 30, and is not a conservative, has not brains.
 -- Winston Churchill