프로필을 볼 수있는 페이지를 만듭니다 (DB에 저장된 모든 정보 - 내가 선택하지 않은 정보 제외).MySQL Query for Profile보기
오류가 발생하는 것 같다<?php
if($_SESSION['id']) {
echo '<h2>Hello, '.$_SESSION['usr'].'!<br>You are registered and logged in!</h2>';
$result = mysql_query("SELECT id,usr,pass,email,dt,priv FROM tz_members WHERE usr = $)SESSION['usr']");
echo "<table border='0'>
<tr>
<th style='width: 15px'>ID</th>
<th style='width: 300px'>Username</th>
<th style='width: 100px'>Privileges</th>
<th style='width: 200px'>Join Date</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['usr'] . "</td>";
echo "<td>" . $row['priv'] . "</td>";
echo "<td>" . $row['dt'] . "</td>";
echo "</tr>";
}
echo "</table>"; }
else echo '<div class="roundbox"><h2>Please, <a href="login.html">login</a> and come back later!</h2></div>';
?>
:
:Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/u594115708/public_html/viewprofile.html on line 66
이 (가) '라인 (66)이'가에 대한 이야기, 더 정확하게하려면이 하나되어
이 코드를
while($row = mysql_fetch_array($result))
내가 뭘 잘못하고 있는지 말해 줄래?
'$) SESSION' ='$ _SESSION'? – DanFromGermany
우선, 당신은 비참하게 오래된'mysql_query'를 사용하고 있으며, 제대로 이스케이프 처리하지는 않습니다 (http://bobby-tables.com/php). 두 번째로'$) SESSION' 근처의 질의에')'가 있습니다. 검색어가 실패했습니다. 결과 행 대신 오류가 발생했으며 무시하고 있습니다. – tadman
흠, 좋은 눈, 하! –