[eluser]kikz4life[/eluser]
i have here a standard php script and trying to convert it using CI active record but this error occured to me. The "mysql_fetch_array" said that supplied argument is not a valid MySQL result resource. Tried to substitute it with $data->result_array() coz mysql_fetch_array is equivalent to result_array(so i thought

).
Code:
$sql='select count('.$postConfig['id'].') as numRows from '.$crudTableName;
$result = mysql_query($sql);
$row = mysql_fetch_array($result,MYSQL_NUM);
$count = $row[0];
$intLimit = $postConfig['limit'];
if( $count > 0 && $intLimit > 0) { $total_pages = ceil($count/$intLimit); }
else { $total_pages = 1; }
$intPage = $postConfig['page'];
if ($intPage > $total_pages){$intPage=$total_pages;}
$intStart = (($intPage-1) * $intLimit);
$sql = 'select '.implode(',',$crudColumns).' from '.$crudTableName;
if($postConfig['search'] == 'true'){
$sql .= ' WHERE ' . $postConfig['searchField'] . ' ' . fnSearchCondition($_POST['searchOper'], $postConfig['searchStr']);
}
$sql .= ' ORDER BY ' . $postConfig['sortColumn'] . ' ' . $postConfig['sortOrder'];
$sql .= ' LIMIT '.$intStart.','.$intLimit;
$result = mysql_query( $sql );
$data->page = $intPage;
$data->total = $total_pages;
$data->records = $count;
$i=0;
while($row = mysql_fetch_array($result,MYSQL_NUM)) {
$data->rows[$i]['id']=$row[0];
$data->rows[$i][$crudConfig['row']]=$row;
$i++;
}
this is the error logs in my firebug
Code:
<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message: mysql_fetch_array(): supplied argument is not a valid MySQL result resource</p>
<p>Filename: controllers/sec_role.php</p>
<p>Line Number: 219</p>
</div>{"page":"1","total":2,"records":"11"}<br />
<b>Fatal error</b>: ob_start() [<a href='ref.outcontrol'>ref.outcontrol</a>]: Cannot use output buffering in output buffering display handlers in <b>C:\xampp\htdocs\myweb\system\libraries\Exceptions.php</b> on line <b>162</b><br />
any comments to this? any pointers will be a great help for me.
thanks