Notice: Undefined index: temperature in C:\xampp\htdocs\1\dht.php on line 20
웹에서 뜨는 텍스트이고 아래는 해당 PHP 소스코드입니다.
20번째 라인이 밑줄과 굵게 표시된 구문입니다.
뭐가 문제일까요?
class dht11{
public $link='';
function __construct($temperature, $humidity){
$this->connect();
$this->storeInDB($temperature, $humidity);
}
function connect(){
$this->link = mysqli_connect('localhost','root','') or die('Cannot connect to the DB');
mysqli_select_db($this->link,'') or die('Cannot select the DB');
}
function storeInDB($temperature, $humidity){
$query = "insert into set humidity='".$humidity."', temperature='".$temperature."'";
$result = mysqli_query($this->link,$query) or die('Errant query: '.$query);
}
}
{if($_GET['temperature'] != '' and $_GET['humidity'] != '')
$dht11=new dht11($_GET['temperature'],$_GET['humidity']);
}
?>
ƴϸ index ⺻ Ͻðų..
ƴϸ get Ķ ѱų
get ° ϴ.
ش籸 ¼ ߰ؼ ߴµ ҽڵ SQL °ɺ ٸ ִµؿ
ƿ ϴ..
php.ini error_reporting ã ~E_NOTICE ߰ݴϴ.
) error_reporting = E_ALL & ~E_NOTICE
Ǵ include Ǵ ùӸ Ʒ ݴϴ.
error_reporting(E_ALL & ~E_NOTICE);
ini_set("display_errors", 1); //1 ȭ鿡 ǥ, 0 ǥ
ذ߽ϴ. α ϳ ۸ذ ָԱ ãư ε ʳ~
Ƶ̳ C ҽ ľ ϴµ ľ ϴ° մϴ..