묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
[PHP] 왕허접 메모장 에러..
2002.11.22 03:59
mysql> desc notepad;
+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| name | varchar(255) | | | | |
| content | text | | | | |
| ip | varchar(48) | YES | | NULL | |
| date | varchar(24) | YES | | NULL | |
+---------+--------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
위와가치 sql 테이블 짜나꾸여.
에러메시지는
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/memo.php on line 48
php소스는.. 아래와 같거든요.. 도저히 모르겠어서.. 지문드려여.. ㅠ.ㅠ
뭐가 잘못되서.. 에러가 나는 건가요 ㅠ.ㅠ
<?
$db = mysql_connect( 'localhost','id','ps' );
$_time = strftime("%x %X");
if ( $name != null )
{
mysql_db_query("notepad_db",
"insert into notepad values ( '$name', '$content', '$REMOTE_ADDR', '$_time' )", $db);
}
$result = mysql_db_query("notepad", "select * from notepad order by date desc", $db);
?>
<table border=0 cellspacing=1 cellpadding=3 bgcolor="#999999" width="600">
<tr>
<th width=80 bgcolor="#EEEBEB" align=center style="line-height:18px;"><font color="black"><span style="font-size:9pt;">name</span></th>
<th width="400"bgcolor="#EEEBEB" align=center style="line-height:18px;"><font color="black"><span style="font-size:9pt;">message</span></th>
<th width=120 bgcolor="#EEEBEB" align=center style="line-height:18px;"><font color="black"><span style="font-size:9pt;">date</span></th>
</tr>
<?
while ($row = mysql_fetch_object ($result))
{
?>
<tr>
<td bgcolor="#FFFFFF" align=center style="line-height:18px;"><font color="black"><span style="font-size:9pt;">
<? echo $row->name ?></td>
<td bgcolor="#FFFFFF" align=center style="line-height:18px;"><font color="black"><span style="font-size:9pt;">
<? echo $row->content ?></td>
<td bgcolor="#FFFFFF" align=center style="line-height:18px;"><font color="black"><span style="font-size:9pt;">
<? echo $row->date ?></span></td>
</tr>
<?
}
?>
</table>
<?
mysql_close( $db );
?>
+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| name | varchar(255) | | | | |
| content | text | | | | |
| ip | varchar(48) | YES | | NULL | |
| date | varchar(24) | YES | | NULL | |
+---------+--------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
위와가치 sql 테이블 짜나꾸여.
에러메시지는
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/memo.php on line 48
php소스는.. 아래와 같거든요.. 도저히 모르겠어서.. 지문드려여.. ㅠ.ㅠ
뭐가 잘못되서.. 에러가 나는 건가요 ㅠ.ㅠ
<?
$db = mysql_connect( 'localhost','id','ps' );
$_time = strftime("%x %X");
if ( $name != null )
{
mysql_db_query("notepad_db",
"insert into notepad values ( '$name', '$content', '$REMOTE_ADDR', '$_time' )", $db);
}
$result = mysql_db_query("notepad", "select * from notepad order by date desc", $db);
?>
<table border=0 cellspacing=1 cellpadding=3 bgcolor="#999999" width="600">
<tr>
<th width=80 bgcolor="#EEEBEB" align=center style="line-height:18px;"><font color="black"><span style="font-size:9pt;">name</span></th>
<th width="400"bgcolor="#EEEBEB" align=center style="line-height:18px;"><font color="black"><span style="font-size:9pt;">message</span></th>
<th width=120 bgcolor="#EEEBEB" align=center style="line-height:18px;"><font color="black"><span style="font-size:9pt;">date</span></th>
</tr>
<?
while ($row = mysql_fetch_object ($result))
{
?>
<tr>
<td bgcolor="#FFFFFF" align=center style="line-height:18px;"><font color="black"><span style="font-size:9pt;">
<? echo $row->name ?></td>
<td bgcolor="#FFFFFF" align=center style="line-height:18px;"><font color="black"><span style="font-size:9pt;">
<? echo $row->content ?></td>
<td bgcolor="#FFFFFF" align=center style="line-height:18px;"><font color="black"><span style="font-size:9pt;">
<? echo $row->date ?></span></td>
</tr>
<?
}
?>
</table>
<?
mysql_close( $db );
?>