登录 | 注册 | FAQ
Anonymous

Please, I need an Urgent help.

+ 发表回复

8 篇帖子 分页: 1 / 1


Please, I need an Urgent help.

ebynasco » 周一 4月 14, 2014 1:08 pm

I wrote a program with php, with intention of achieving log in and log out page. After i must have achieved that. Then i tried logging in with a username and password, then i saw 'Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C: \wamp\www\login.php on line 177' what should I do?
头像

ebynasco

  • 帖子: 8
  • 注册: 周四 3月 06, 2014 7:01 am

Re: Please, I need an Urgent help.

XainPro » 周一 4月 14, 2014 3:28 pm

mysql_fetch_assoc() expects parameter 1 to be resource, boolean given
means your query got no result or your query is not correct there is nothing in your result to fetch
show us your complete code to help you.
头像

XainPro

  • 帖子: 3933
  • 注册: 周五 2月 17, 2012 8:10 pm

Re: Please, I need an Urgent help.

ebynasco » 周二 4月 15, 2014 7:30 am

This is part of it sir.

173 $sql = "SELECT * FROM members WHERE confirmation = '1' AND type != 'uploads/propic.jpg' ORDER BY RAND() LIMIT 9";
174 $result = mysql_query($sql);
175 if($result > 0){
176 echo '<div align = "center" style = "margin-left: 35px; background: #111; color: #fff; width: 250px;"friends</div>';}
177 while($row = mysql_fetch_assoc($result))
178 {$first = $row['image'];
at line 177 i do have problem.
头像

ebynasco

  • 帖子: 8
  • 注册: 周四 3月 06, 2014 7:01 am

Re: Please, I need an Urgent help.

XainPro » 周二 4月 15, 2014 7:48 am

make correction to you line no 175

if(mysql_num_rows($result) > 0)
头像

XainPro

  • 帖子: 3933
  • 注册: 周五 2月 17, 2012 8:10 pm

Re: Please, I need an Urgent help.

ebynasco » 周二 4月 15, 2014 10:40 pm

Sir, I did the correction. But, no difference. Instead, I saw the same error that appeared previously, both on line 177 and 175. I don't know what to do.
头像

ebynasco

  • 帖子: 8
  • 注册: 周四 3月 06, 2014 7:01 am

Re: Please, I need an Urgent help.

XainPro » 周三 4月 16, 2014 10:32 pm

then there should be some kind of error in your query add following code between line no 174 and 175

echo mysql_error($result) . "\n";

and check and tell me the output
it will show you what is the error in your query
头像

XainPro

  • 帖子: 3933
  • 注册: 周五 2月 17, 2012 8:10 pm

Re: Please, I need an Urgent help.

ebynasco » 周四 4月 17, 2014 8:16 am

The same error do show on line 175. I'm just totally confused on what should be the problem. Because all the programs i wrote are in order.
头像

ebynasco

  • 帖子: 8
  • 注册: 周四 3月 06, 2014 7:01 am

Re: Please, I need an Urgent help.

XainPro » 周四 4月 17, 2014 9:10 am

i am saying you to do this and tell me this output

173 $sql = "SELECT * FROM members WHERE confirmation = '1' AND type != 'uploads/propic.jpg' ORDER BY RAND() LIMIT 9";
174 $result = mysql_query($sql);
175 echo mysql_error($result);
176 die();
头像

XainPro

  • 帖子: 3933
  • 注册: 周五 2月 17, 2012 8:10 pm


+ 发表回复

分页: 1 / 1