Loading...
 

DAL method: CustomQuery()

Runs custom SQL query.
Syntax
PHP
CustomQuery($sql)
ASP
CustomQuery(sql)
Arguments
sql - SELECT clause. Example: "select * from UsersTable where ID=32".
Return value
Returns the recordset.
Example 1
Query that doesn't return data:
PHP
$sql = "update Users set active=0 where id=32";
CustomQuery($sql);
ASP
sql = "update Users set active=0 where id=32"
CustomQuery(sql)
Example 2
Query that returns data:
PHP
$sql = "select count(*) as c from orders group by customerid";
$rs = CustomQuery($sql);
$data = db_fetch_array($rs);
echo "Number of customers: " . $data["c"];
ASP
sql = "select count(*) as c from orders group by customerid"
set rs = CustomQuery(sql)
Response.Write "Number of customers: " & rs("c")

See also