Web hosting india - Chapter 4: Architecture of an Intranet Application The
Chapter 4: Architecture of an Intranet Application The SQL statement SELECT ID, NAME FROM PROD_TBL is stored in $statement variable and passed to the DBI::query() method. The result is tested first for null. If the result is null, the database error is printed using the DBI::getError() method. If there are no database errors, the next check is made to see if there are any rows using the numRow() method from the $result object. If there are no rows, an appropriate message is printed. If there are data in the returned $result object, the result is printed in a loop using the fetchRow() method. The row data is fetched in $row object. The $row->DATA_FIELD method is used to get the data for each field. For example, to retrieve the NAME field data, the $row->NAME value is accessed. . quote(): This is a utility function that puts a pair of single quotes around a string to protect the string from being passed without quotation. Here s an example in which the $name field is single-quoted using $this->dbi>quote($name) call: