PHP ҽ

   
   ȸ 3065   õ 0    

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']);

}

?>

ª ϼ ϰ.
ֱ 2019-11
isset غ ^^
ƴϸ index ⺻ Ͻðų..
ƴϸ get Ķ͸ ѱų

get ° ϴ.
     
2019-11
PHP ϳ Ͻô° 𸣰ڽϴ..

ش籸 ¼ ߰ؼ ߴµ ҽڵ SQL °ɺ ٸ 𿣼 ִµؿ
MC 2019-11
if($_GET['temperature'] != '' and  $_GET['humidity'] != ''){
     
2019-11
ش籸 ϰ ʿ ߻ SQL DB ΰħص ϴ Ͱ ʾƼ

ƿ ϴ..
ܹl 2019-11
Notice ƴ, ǰ ȵǾµ Ϸ Ҷ 쿡 ޽ ؼ 缭 óϽǷ Ȯϰ Ͽ ؾ մϴ. notice ޽ ϰ. Ʒ Ͻø ˴ϴ.

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 ǥ
     
2019-11
մϴ.

ذ߽ϴ. α׷ ϳ ۸ذ ָԱ ãư ε ʳ׿~

Ƶ̳ 󿡼 C ҽ ľ ϴµ ľ ϴ° մϴ..


QnA
Page 1154/5682
2014-05   4953185   1
2015-12   1489694   ް
2014-08   3246  
2020-09   3246  
2017-04   3246   ϴû
2020-04   3246  
2022-09   3246   ״
2020-10   3246   3
2020-11   3246   Ƹ쾲
2019-05   3246   ɳ
2016-07   3246   Minus1
2021-06   3246   2CPU
2014-03   3246  
2017-06   3246  
2017-09   3246   Sakura24
2014-04   3246   ̴
2018-07   3246  
2015-04   3246   ÿ
2017-06   3246   ̴
2017-03   3247   cpu
2017-08   3247   cpu
2014-05   3247   oȿo