이 오류가 계속 발생합니다. 그리고 내가 아는하지 않는 이유 ... 감사PHP 오류 공지 : 정의되지 않은 색인 : C : Wamp www tweetball classes word.class.php의 사용자 ID :
공지 사항 : 정의되지 않은 인덱스 : C에서 사용자 ID : \ WAMP \ www가 \ tweetball 클래스 \ \ word.class.php 라인
<?php
session_start();
class Word
{
private $m_sWord;
private $m_sMessage;
private $link;
public function __set($p_sProperty, $p_vValue)
{
switch($p_sProperty)
{
case "Message":
$this->m_sMessage = $p_vValue;
break;
}
}
public function __get($p_sProperty)
{
$vResult = null;
switch($p_sProperty)
{
case "Message":
$vResult = $this->m_sMessage;
break;
}
return $vResult;
}
public function Save()
{
include("Connection.php");
$sSql = "insert INTO words (word, FK_UserID) VALUES ('$_POST[message]','$_POST[UserID]')";
if ($rResult = mysqli_query($this->link, $sSql))
{
echo "";
}
else
{
throw new Exception('We could not save your word!');
}
mysqli_close($this->link);
}
public function CreateNew()
{
$m_sHost = "localhost";
$m_sUser = "root";
$m_sPassword = "";
$m_sDatabase = "tweetball";
$link = mysqli_connect($m_sHost,$m_sUser,$m_sPassword,$m_sDatabase);
if($link!=null){
$this->link=$link;
}
else
{
throw new Exception("There seems to be a database problem. Try again later");
}
}
public function getWord()
{
$m_sHost = "localhost";
$m_sUser = "root";
$m_sPassword = "";
$m_sDatabase = "tweetball";
$sSql = "select * from tweetball where WordID = 1;";
if ($rResult = mysqli_query($this->link, $sSql))
{
$singleRecord = mysqli_fetch_assoc($rResult);
$message = $singleRecord['Word'];
}
else
{
throw new Exception('We could get your word!');
}
mysqli_close($link);
return($message);
}
}
?>
나는 [SQL injection] (http://stackoverflow.com/questions/332365/xkcd-sql-injection-please-explain)에 대해서도 배울 시간이있다. –