회원정보 select SQL 에러문제 채택완료
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/p3.php on line 23
위와 같이 에러가 납니다. $row = mysql_fetch_array($res) 의 어디가 문젠가요?
[code]
include 'db_connect.php'; // db connect[/code]
답변 7개
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
어떤 에러가 발생하는지 질문을 새로 등록하셔야 확인이 더 용이 할 같습니다.
어떤 오류가 발생하는지도 알려주셔야 확인이 가능 합니다.
댓글을 작성하려면 로그인이 필요합니다.
<br />
mysql_query() or die(mysql_error())<br />
해보세요
답변에 대한 댓글 3개
if (!$result)
{
die('Invalid query');
}
$res = mysql_query($result)
while ($row = mysql_fetch_array($res)) { // line 31*******************
echo $row['Id'];
echo $row['Username'];
echo $row['Password'];
echo $row['Email'];
echo $row['Gender'];
echo $row['Zipcode'];
}
위와 같이 하니 아래와 같이 Parse error 가 납니다...
Parse error: syntax error, unexpected T_WHILE in /p3.php on line 31
[code]
$username = $_GET["username"];
$email = $_GET["email"];
$zip = $_GET["zip"];
$bio = $_GET["bio"];
$website = $_GET["website"];
$major = $_GET["major"];
$color = $_GET["color"];
// connect DB
include 'db_connect.php'; // include localhost, username, password, database
mysql_query("UPDATE `sung2` SET `Email`='$email', `Zipcode`='$zip', `Bio`='$bio', `Website_URL`='$website', `Major`='$major', `Color`='$color' WHERE `Username` = '".$_GET['username']."'");
[/code]
위와 같이 mysql_query 문 작성하니 에러가 납니다.
update문은요 mysql_error로 에러 출력 해보세요.
문법은 맞는 것 같은데요.
지금까지 올려주신 쿼리 문법은 잘 못 된것이 없어요.
이 부분이 문제가 아닌 것 같아요.
디버깅을 해보셔야 할 것 같은데요.
db_commect.php 부터요.
댓글을 작성하려면 로그인이 필요합니다.
현재&nbsp; 쿼리&nbsp; 에러 없어요&nbsp; 제가&nbsp; 알려준&nbsp; 쿼리잖아요&nbsp; mysql fetch array&nbsp; 네이버 검색해서 명령어 사용 법 익히고요 2번째&nbsp; 파라미터를 넣어보세요<br />
<br />
mysql fetch array($res,MYSQL_BOTH)
댓글을 작성하려면 로그인이 필요합니다.
http://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter-1-to-be-resource-or-mysqli-result-boole">http://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter-1-to-be-resource-or-mysqli-result-boole
이 문서 참조해보세요
$res 에 값이 없어서 나오는 오류 같습니다.
댓글을 작성하려면 로그인이 필요합니다.
$result 밑에 echo $result; 하신 후에 나온 쿼리문을 phpmyadmin에 넣어 보세요.
그러면 어떤 게 문제인지 나올 겁니다.
답변에 대한 댓글 1개
while ($row = mysql_fetch_array($res)) { // line 23 에러나는 부분
이부분이 문제입니다...ㅠㅠ
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인