6 var $_currentRecord = array();
10 function result($queryId, $sql) {
11 $this->_queryId = $queryId;
13 if ($this->_queryId != false) {
14 $this->_numRows = @mysql_num_rows($this->_queryId);
15 $this->_numFields = @mysql_num_fields($this->_queryId);
16 $this->_currentRow = -1;
17 $this->_currentRecord = array();
19 $this->exception("result failed.");
24 if ($this->_currentRow + 1 >= $this->_numRows) {
27 $this->_currentRecord = @mysql_fetch_assoc($this->_queryId);
34 function absolute($row) {
36 // positive row number
37 @mysql_data_seek($this->_queryId, $row-1);
38 $this->_currentRecord = @mysql_fetch_assoc($this->_queryId);
39 $this->_currentRow = $row;
41 // not implemented yet
43 $this->exception("Cannot absolute position to row 0");
48 function getRecord() {
49 return $this->_currentRecord;
52 function getString($column) {
53 if (is_int($column) == true) {
54 return (string)$this->_currentRecord[$column-1];
56 return (string)$this->_currentRecord["$column"];
60 function getInt($column) {
61 if (is_int($column) == true) {
62 return (int)$this->_currentRecord[$column-1];
64 return (int)$this->_currentRecord["$column"];
69 function getVariable($column) {
70 return (int)$this->_currentRecord["$column"];
74 function getDouble() {
75 if (is_int($column) == true) {
76 return (double)$this->_currentRecord[$column-1];
78 return (double)$this->_currentRecord["$column"];
83 if ($this->_currentRow < 0) {
86 return $this->_currentRow + 1;
91 function getNumRows() {
92 return $this->_numRows;
96 function getNumFields() {
97 return $this->_numFields;
101 function exception($errorMsg) { //Internal only!
102 die("<pre>SQLException: ".$msg."</pre>");