Aldığım hata;
Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\websites\.....\emlak\class\Class.RecordSet.php on line 48
Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\websites\.....\emlak\class\Class.RecordSet.php on line 48
Error in RecordSet.Query() :
php kodlarım;
class RecordSet{
var $PageCount = null;
var $RecordCount = null;
var $CurrentPage = 1;
var $RPP = 10; // Record per page
var $Records = null; // Array of all records
var $Current = null; //Array of current record
var $Table = null;
var $ID = null; //Current record id
var $NewRow = false;
var $No=0;
var $PageLast=null;
var $Filter = "";
var $SqlQuery = "";
var $Type = "RecordSet";
function RecordSet($table){
$this->Table = $table;
}
function Select($filter=""){
$this->Records = null;
$this->Filter = $filter;
if($filter=="")
$query = "select * from " . $this->Table;
else
$query = "select * from " . $this->Table . " " . $filter;
// if ($result = $mysqli->query("Error [in RecordSet.Select")) {
$result = mysqli_query($query) or die("Error [in RecordSet.Select] : ".mysqli_error());
while($row=mysqli_fetch_array($result)) {
$this->Records[] = $row;
}
$this->Current = $this->Records[0];
$this->RecordCount = mysql_num_rows($result);
$this->PageLast = $this->RecordCount-1;
}
function Query($query=""){
if($query=="")
$query = "select * from " . $this->Table;
//$result = mysqli_query($result) or die("Error [in RecordSet.Select] : ".mysqli_error());
mysqli_query($result) or die("Error in RecordSet.Query() : ".mysqli_error());
// mysqli_query()
// $mysqli -> query($result);
while($row=mysqli_fetch_array($result)) {
$this->Records[] = $row;
}
$this->Current = $this->Records[0];
$this->RecordCount = mysqli_num_rows($result);
$this->PageLast = $this->RecordCount-1;
$this->SqlQuery = $query;
}
function Search($columns,$pattern){
$temp = array();
$res = true;
while($row = $this->Read()){
for($i=0;$i
if($res) break;
}
if($res) $temp[]=$row;
}
$this->Records = $temp;
$this->No=0;
$this->RecordCount = count($this->Records);
$this->PageLast = $this->RecordCount-1;
}
function Replace($columns,$pattern,$replacement){
$temp = array();
$res = true;
while($row = $this->Read()){
for($i=0;$i
}
$temp[]=$row;
}
$this->Records = $temp;
$this->No=0;
$this->RecordCount = count($this->Records);
$this->PageLast = $this->RecordCount-1;
}
function GotoPage($CurrentPage){
if($CurrentPage > $this->PageCount && $this->RecordCount != 0) die("Error [in RecordSet.GotoPage] : " . _PageNumberExceed_);
$this->CurrentPage = $CurrentPage;
$this->No = (($CurrentPage -1)*$this->RPP);
$this->PageLast = $this->No + $this->RPP - 1;
if($this->PageLast > ($this->RecordCount-1)) $this->PageLast=$this->RecordCount-1;
}
function SetRPP($rpp){
$this->RPP = $rpp;
$this->PageCount = ceil($this->RecordCount / $this->RPP);
$this->PageLast = ($this->PageCount > 1) ? $rpp-1 : $this->RecordCount - 1;
}
function AddNew(){
$this->NewRow = true;
}
function Update(){
if($this->NewRow){
mysql_query("insert into ".$this->Table." (id) values ('')") or die("Error [in RecordSet.Update] : ".mysql_error());
$this->ID = mysql_insert_id();
}
$sql = "";
foreach($this->Current as $key=>$value){
$sql .= "$key = '$value',";
}
$sql = substr($sql, 0, -1);
mysql_query("update ".$this->Table." set $sql where id='".$this->ID."'") or die("Error [in RecordSet.Update] : ".mysql_error());
$this->NewRow = false;
}
function Read(){
if($this->No <= $this->PageLast){
$row = $this->Records[$this->No];
$this->No++;
$this->Current = $row;
$this->ID = $row["id"];
return $row;
}
}
function Delete($filter){
mysqli_query(delete. $this->Table .$filter) or die(Error .mysqli_error());
}
}
?>