Sunucuda Hataları!

1 Cevap php

i mysql db kullanıcı bilgilerinizi aşağıdaki php kod seçerek var

$mysql = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or die('There was a problem connecting to the database');
$stmt = $mysql->prepare('SELECT personalinfo.userid, personalinfo.firstname, personalinfo.lastname FROM personalinfo INNER JOIN applications ON personalinfo.userid = applications.userid WHERE applications.jobref = ?');
$stmt->bind_param('i',$jr);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($userID,$firstName,$lastName);
$count = $stmt->num_rows();

I have tested this code localy at it works fine, however when i try to test on a live server, i keep getting the following error "Fatal error: Call to a member function bind_param() on a non-object in C:\path\to\directory"

Peşin bakışlarıma thx,

Aaron

Herhangi

1 Cevap

Peki, mysqli::prepare(), onu dönecektir için belgelerine göre FALSE {aramaya çalışırken bir "non-nesne" hatası alıyorsanız neden olan bir hata varsa [(2)]} $stmt bu noktada bir nesne değil beri.

Yani hem mevcut hata ve gelecekteki herhangi bir hata uğruna, bir açıklama oluştururken yanlışlığı kontrol ve buna göre hareket etmek emin olun.

$mysql = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or die('There was a problem connecting to the database');
$stmt = $mysql->prepare('SELECT personalinfo.userid, personalinfo.firstname, personalinfo.lastname FROM personalinfo INNER JOIN applications ON personalinfo.userid = applications.userid WHERE applications.jobref = ?');

if ( $stmt )
{
  $stmt->bind_param('i',$jr);
  $stmt->execute();
  $stmt->store_result();
  $stmt->bind_result($userID,$firstName,$lastName);
  $count = $stmt->num_rows();
} else {
  // something went wrong
  // perhaps display the error?
  echo $mysql->error;
}