Şimdi Ara

php hatası yardımcı olabilir misniz?

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
2 Misafir - 2 Masaüstü
5 sn
13
Cevap
0
Favori
545
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • Merhaba, hosting firmam 7.2 versiyonuna geçmiş benim php kodum 5.4 tü. Düzeltmemde yardımcı olabşlecek var mı?

    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<count($columns);$i++){
    $res = preg_match($pattern,$row[$columns[$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<count($columns);$i++){
    $row[$columns[$i]] = preg_replace($pattern,$replacement,$row[$columns[$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());
    }

    }
    ?>







  • "48. satırda (veya daha önceki satırda) beklenen 2 parametre varken, 1 parametre eklenmiş." Hata bildirimi bunu söylüyor.
  • hatanın olduğu 48.satırı gösterirmisin
  • mysqli_query($result) or die("Error in RecordSet.Query() : ".mysqli_error());
  • aozkan_2 A kullanıcısına yanıt
    mysqli_query($result,buraya çalıştırmak istediğin değişkenlerden biri =>$filter,$query).sürekli bu hataları verecekdir.oraya fonksiyon özellikli değişkenler veya başka veriler ataman lazım.



    daha detaylı=>
    Stack Overflow
    Proper mysqli_query and mysqli_error configuration
    https://stackoverflow.com/questions/14002994/proper-mysqli-query-and-mysqli-error-configuration



    < Bu mesaj bu kişi tarafından değiştirildi ibrahimyonetici -- 18 Mart 2020; 21:54:34 >




  • 47 mysqli_query($result,=>$filter,$query).
    48// mysqli_query($result) or die("Error in RecordSet.Query() : ".mysqli_error());
    49// mysqli_query()
    50// $mysqli -> query($result);
    51 while($row=>mysqli_fetch_array($result)) {
    52 $this->Records[] = $row;
    53 }
    54 $this->Current = $this->Records[0];
    55 $this->RecordCount = mysqli_num_rows($result);
    56 $this->PageLast = $this->RecordCount-1;
    57 $this->SqlQuery = $query;
    58 }


    yine bu hatayı verdi
    Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')' in C:\websites\...\emlak\class\Class.RecordSet.php on line 47



    eski kodlar
    mysql_connect
    mysql_query
    mysql_fetch ...

    kodlarıydı, ben mysqli şekline dönüştürmek istiyorum. Aynı zamanda öğrenmek istiyorum. sizin yazdığınız yerde bir değişken yoktu.

    // mysql_query($result) or die("Error in RecordSet.Query() : ".mysql_error());

    kod buydu mysqli ben yaptım. bu konuda yardım istiyorum.




  • aozkan_2 A kullanıcısına yanıt
    şuan sms onayı yapamıyorum.ben bir sicripte mysql olan yerli hep mysqliye çevirdim.ama çok hata aldım söyliyim.direk baştan mysqli fonksiyonlara bak ya da pdo ya geç.pdo her veri tabanıyla uyumlu çalışır.



    < Bu mesaj bu kişi tarafından değiştirildi ibrahimyonetici -- 18 Mart 2020; 22:38:37 >
  • Yapay Zeka’dan İlgili Konular
    Daha Fazla Göster
  • yapayım da hata alayım sorun değil öğrenmek istiyorum aynı anda bu sayfada yardımcı oluursan diğer hataları ben düzeltirim.
  • quote:

    Orijinalden alıntı: aozkan_2

    yapayım da hata alayım sorun değil öğrenmek istiyorum aynı anda bu sayfada yardımcı oluursan diğer hataları ben düzeltirim.
    dediğim gibi çok zaman alır.en fazla kaynak gösteririm ne yapman gerektiğini yönünde
  • daha önce yazmış ollduğun kod değil ama hatayı düzelten kod bir iki örnek gösterirsen ben devam ederim
  • aozkan_2 A kullanıcısına yanıt
    az önce yazdığına baktım da böle değil mysqli_query($result,=>$filter,$query).

    şöyle demek istedim mysqli_query($result,$filter).

    veya mysqli_query($result,$query).

    dene

    sürekli senden parametreler isteyecektir



    < Bu mesaj bu kişi tarafından değiştirildi ibrahimyonetici -- 19 Mart 2020; 0:47:34 >
  • sayfa geldi bu defa sayfa içinde yani index içinde kodun çalıştığı kısımda bu hatayı verdi.

    Warning: mysqli_query() expects parameter 1 to be mysqli, string given in C:\websites\class\Class.RecordSet.php on line 33

    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:\websites\class\Class.RecordSet.php on line 34

    33 $result = mysqli_query($query,$result);
    34 while($row=mysqli_fetch_array($result)) {
    35 $this->Records[] = $row;
    36 }
    37 $this->Current = $this->Records[0];
    38// $this->RecordCount = mysql_num_rows($result);
    39 $this->PageLast = $this->RecordCount-1;
    40 }


    kodlar bunlar
  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.