Please enable JavaScript to view this site.

Navigation: » No topics above this level «

DAL method: FetchByID() (Deprecated)

Scroll Prev Next More

 

Deprecated

This function is deprecated, and we recommend using the DB:Select() function from Database API.

 

Selects one or more records from the database that matches the condition.

Syntax

FetchByID()

Arguments

No arguments.

Return value

Returns the recordset on success or FALSE on error.

Example

Select all records where ID is '32'. To fetch a returned row as an associative array, use the db_fetch_array function.

 

var tblUsers = GlobalVars.dal.Table("UsersTable");
tblUsers.Param["ID"] = 32;
XVar rs = tblUsers.FetchByID();
XVar data;
while(data = CommonFunctions.db_fetch_array(rs))
  MVCFunctions.Echo(data["UsersName"]);

 

Note: the db_fetch_array function is deprecated, and we recommend using the fetchAssoc function instead.

 

The corresponding SQL query:

 

select * from carsusers where ID=32

See also:

QueryResult object: fetchAssoc

DAL method: DBLookup

DB API: Select

DB API: LastId

Database API

About Data Access Layer