PHP ¼Ò½º °ü·Ã

   Á¶È¸ 3099   Ãßõ 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']);

}

?>

ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
isset À» »ç¿ëÇغ¸¼¼¿ä ^^
¾Æ´Ï¸é index ƒ”ÀÌ ¾øÀ»¶§ ±âº»°ªÀ» ÁöÁ¤ÇϽðųª..
¾Æ´Ï¸é get ÆĶó¹ÌÅ͸¦ ³Ñ±â°Å³ª

ÇöÀç ¹®Á¦´Â get °ªÀÌ ¾ø´Â°Å °°½À´Ï´Ù.
     
ÀÌÈñÁÖ 2019-11
PHP¸¦ Çϳªµµ ¸ô¶ó¼­ ¹«½¼ ¸»¾¸À» ÇϽô°ÇÁö Àß ¸ð¸£°Ú½À´Ï´Ù..¤¾¤¾

Çش籸¹®Àº ¾î¼´Ù ¿À·ù¸¦ ¹ß°ßÇؼ­ ¼öÁ¤Çߴµ¥ ¼Ò½ºÄÚµå´ë·Î SQL¿¡¼­ °ªÀ» ÀÐÀ» ¼ö°¡ ¾ø´Â°Éº¸´Ï ´Ù¸¥ ¾îµð¿£¼±°¡ ¹®Á¦°¡ ÀִµíÇØ¿ä
MC¾µ 2019-11
if($_GET['temperature'] != '' and  $_GET['humidity'] != ''){
     
ÀÌÈñÁÖ 2019-11
³× Çش籸¹®À» ¼öÁ¤ÇÏ°í À¥ÂÊ¿¡¼­´Â ¹®Á¦°¡ ¹ß»ýÇÏÁö ¾ÊÁö¸¸ SQL¿¡¼­ DB¸¦ »õ·Î°íħÇصµ ¿øÇÏ´Â µ¥ÀÌÅÍ°ªÀÌ µé¾î¿ÀÁö ¾Ê¾Æ¼­

¾Æ¿¹ °¥¾Æ ¾þ¾ú½À´Ï´Ù..
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 4644/5686
2015-12   1515504   ¹é¸Þ°¡
2014-05   4979419   Á¤ÀºÁØ1
2017-03   3099   omega3
2018-10   3099   ÃÊÈ£±â
2019-12   3099   ¸¸»ç¿ÀÄÉÀÌ
2017-07   3099   ±ô¦
2018-11   3099   ´«ºÎ½Å¾Æħ
2022-06   3099   drama
2022-01   3099   ¾Æ±×´Ï¸ðÅÍ
2020-02   3099   Æ۽̱Û
2021-04   3099   ¹éµÎ»ê
2018-01   3098   Ä«¸Ó
2020-06   3098   U3164
2019-07   3098   ½Å¿ì¼·
2021-03   3098   Ibory
2018-07   3098   ¾óÀ½°øÁÖ
2020-07   3098   Àü¼³¼ÓÀǹ̡¦
2019-03   3098   ÇåÅÍD
2020-12   3098   Á¤ÀǼ®
2015-03   3098   AKAÁö´Ï
2018-12   3098   ¶¥ºÎÀÚ
2020-12   3098   ³ª½ºÃʺ¸¿¡¿ä