PHP ¼Ò½º °ü·Ã

   Á¶È¸ 3098   Ãßõ 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 4642/5686
2014-05   4975486   Á¤ÀºÁØ1
2015-12   1511642   ¹é¸Þ°¡
2018-07   3100   º°¿Õ
2019-03   3100   ½ÅÀº¿Ö
2017-07   3099   SKIM
2018-08   3099   ¸ÓÀç±ä
2019-01   3099   Nikon
2019-11   3099   ÀÌÈñÁÖ
2019-09   3099   ±Þ¿©ÀÏ¿¡¸¸³ª¿ä
2014-03   3099   ¹æoÈ¿o¹®
2020-03   3099   ±èÁ¦l±è¿ëȯ
2017-06   3099   ´ÐÀÌ¿ä
2019-03   3099   ´Þ¹¦
2017-07   3098   ŵ°íÀ×
2020-09   3098   ¶¥ºÎÀÚ
2020-04   3098   °­Çѱ¸
2021-05   3098   ÀÌ¿øÀçK
2018-11   3098   Ȩ¼­¹ö°¡µ¿Áß
2017-03   3098   Çϼ¿È£ÇÁ
2021-06   3098   »ßµ¹À̽½ÇÄÀÌ
2020-04   3098   ¸®¿À
2017-03   3098   omega3