Phpauction - View feedback error

Thread Solved

Join Date: Mar 2005
Posts: 21
Reputation: Cobber is an unknown quantity at this point 
Solved Threads: 0
Cobber Cobber is offline Offline
Newbie Poster

Phpauction - View feedback error

 
0
  #1
Jun 30th, 2008
Hi,

I don't know if this is the right forum to post this, if not please move it or just delete it.

I installed Phpauction via Fantastico after trying several purchased scripts that just wouldn't work.

Everything is working fine except the "View Feedback" links which give the following error messages:

  1. Warning: mysql_fetch_array(): supplied argument IS NOT a valid MySQL result resource IN /home/ozwww04/public_html/auction/yourfeedback.php on line 65
  2.  
  3. Warning: Cannot modify header information - headers already sent BY (output started at /home/ozwww04/public_html/auction/yourfeedback.php:65) IN /home/ozwww04/public_html/auction/includes/stats.inc.php on line 79
  4.  
  5. Warning: Cannot modify header information - headers already sent BY (output started at /home/ozwww04/public_html/auction/yourfeedback.php:65) IN /home/ozwww04/public_html/auction/themes/DEFAULT/header.php.html on line 1

The feedback is still displayed, I just get these warnings at the top of the screen. I couldn't see any obvious errors in yourfeedback.php but then I'm not much good at PHP code.

I tried removing the entries at the end of the file for calling templates, but that really sent it nuts.

Here is the file. I would greatly appreciate it if anyone could "spot the obvious error" for me:

  1. <?#//v.3.2.2
  2.  
  3. #///////////////////////////////////////////////////////
  4. #// COPYRIGHT 2007 Phpauction.org ALL RIGHTS RESERVED //
  5. #///////////////////////////////////////////////////////
  6.  
  7. include "./includes/config.inc.php";
  8. include $include_path."dates.inc.php";
  9. include $include_path."membertypes.inc.php";
  10. foreach($membertypes as $idm => $memtypearr) {
  11. $memtypesarr[$memtypearr['feedbacks']]=$memtypearr;
  12. }
  13. ksort($memtypesarr,SORT_NUMERIC);
  14.  
  15. if (($_SERVER["REQUEST_METHOD"]=="GET" || !$_SERVER["REQUEST_METHOD"])) {
  16. $secid = $_SESSION['PHPAUCTION_LOGGED_IN'];
  17. $TPL_rater_nick=$_SESSION['PHPAUCTION_LOGGED_IN_USERNAME'];
  18. $sql="SELECT nick, rate_sum, rate_num FROM PHPAUCTIONXL_users WHERE id=".intval($secid);
  19. $res=mysql_query ($sql);
  20. if ($res) {
  21. if (mysql_num_rows($res)>0) {
  22. $arr=mysql_fetch_array ($res);
  23. $TPL_nick=$arr['nick'];
  24. $i=0;
  25. foreach ($memtypesarr as $k=>$l) {
  26. if($k >= $arr['rate_sum'] || $i++==(count($memtypesarr)-1)) {
  27. $TPL_rate_ratio_value="<img src=\"./images/icons/".$l['icon']."\" alt=\"".$l['icon']."\" />";
  28. break;
  29. }
  30. }
  31. $TPL_feedbacks_num=$arr['rate_num'];
  32. $TPL_feedbacks_sum=$arr['rate_sum'];
  33. } ELSE {
  34. $TPL_err=1;
  35. $TPL_errmsg="$ERR_105";
  36. }
  37. } ELSE {
  38. $TPL_err=1;
  39. $TPL_errmsg="$ERR_106";
  40. }
  41.  
  42. if ($_GET[pg]==0) $pg = 1;
  43. $lines = (INT)$lines;
  44. if ($lines==0) $lines = 5;
  45. $left_limit = ($_GET[pg]-1)*$lines;
  46. $rsl = mysql_query ( "SELECT count(*) FROM PHPAUCTIONXL_feedbacks WHERE rated_user_id=".intval($secid));
  47. if ($rsl) {
  48. $hash = mysql_fetch_array($rsl);
  49. $total = (INT)$hash[0];
  50. } ELSE $total = 0;
  51. $TPL_feedbacks_num=$total;
  52.  
  53. /* get number of pages */
  54. $pages = CEIL($total/$lines);
  55.  
  56. $sql="SELECT f.*,a.title FROM PHPAUCTIONXL_feedbacks f
  57. LEFT OUTER JOIN PHPAUCTIONXL_auctions a
  58. ON a.id=f.auction_id
  59. WHERE rated_user_id='$secid'
  60. ORDER by feedbackdate DESC
  61. LIMIT $left_limit,$lines";
  62. $res=mysql_query ($sql);
  63. $i=0;
  64. $feed_disp=array();
  65. while ($arrfeed = mysql_fetch_array($res)) {
  66. $feed_disp[$i]["username"]=$arrfeed['rater_user_nick'];
  67. $feed_disp[$i]["auctionurl"]=(($arrfeed['title']) ? "<a href='item.php?id=".$arrfeed['auction_id']."'>".$arrfeed['title']."</a>":$MSG_113.$arrfeed['auction_id']);
  68. $feed_disp[$i]["feedback"]=nl2br(stripslashes($arrfeed['feedback']));
  69. $feed_disp[$i]["rate"]=$arrfeed['rate'];
  70. $feed_disp[$i]["feedbackdate"] = FormatDate($arrfeed['feedbackdate']);
  71. $sql="SELECT id,rate_num,rate_sum FROM PHPAUCTIONXL_users WHERE nick='".$feed_disp[$i]["username"]."'";
  72. $usarr=mysql_fetch_array(mysql_query ($sql));
  73. $feed_disp[$i]['usfeed']=$usarr['rate_sum'];
  74. $feed_disp[$i]['usflink']="profile.php?user_id=".$usarr['id']."&auction_id=".$arrfeed['auction_id'];
  75. $j=0;
  76. foreach ($memtypesarr as $k=>$l) {
  77. if($k >= $usarr['rate_sum'] || $j++==(count($memtypesarr)-1)) {
  78. $feed_disp[$i]['usicon']="<img src=\"./images/icons/".$l['icon']."\" alt=\"".$l['icon']."\" />";
  79. break;
  80. }
  81. }
  82. switch($feed_disp[$i]['rate']) {
  83. CASE 1 : $feed_disp[$i]['img']="./images/positive.gif";
  84. break;
  85. CASE -1: $feed_disp[$i]['img']="./images/negative.gif";
  86. $sql="SELECT * FROM PHPAUCTIONXL_feedforum WHERE feed_id=".$arrfeed['id']." ORDER BY seqnum ASC";
  87. $res_=@mysql_query ($sql);
  88. if($res_ && mysql_num_rows($res_)>0) {
  89. while($feedfor=mysql_fetch_array($res_)) {
  90. $feedfor["commentdate"] = FormatDate($feedfor['commentdate']);
  91. $feedfor['username']=($feedfor['user_id']==$secid) ? $TPL_nick : $arrfeed['rater_user_nick'];
  92. $feedfor['comment']=nl2br(strip_tags(stripslashes(($feedfor['comment']))));
  93. $feed_disp[$i]['feedforum'][$feedfor['seqnum']]=$feedfor;
  94. }
  95. $nextfeedlink=END($feed_disp[$i]['feedforum']);
  96. if((($_SESSION['PHPAUCTION_LOGGED_IN']==$arrfeed['rated_user_id'] && $nextfeedlink['user_id']==$usarr['id'])
  97. || ($_SESSION['PHPAUCTION_LOGGED_IN']==$usarr['id'] && $nextfeedlink['user_id']==$arrfeed['rated_user_id'])) && $nextfeedlink['seqnum']<2)
  98. $feed_disp[$i]['nextfeedforum']="<a href='addfeedforum.php?feed_id=".$nextfeedlink['feed_id']."&seqnum=".$nextfeedlink['seqnum']."'>".$MSG_25_0201."</a>";
  99. ELSE
  100. $feed_disp[$i]['nextfeedforum']="";
  101. } ELSE {
  102. if($_SESSION['PHPAUCTION_LOGGED_IN']==$arrfeed['rated_user_id'])
  103. $feed_disp[$i]['nextfeedforum']="<a href='addfeedforum.php?feed_id=".$arrfeed['id']."&seqnum=0'>".$MSG_25_0201."</a>";
  104. ELSE
  105. $feed_disp[$i]['nextfeedforum']="";
  106. }
  107. break;
  108. CASE 0 : $feed_disp[$i]['img']="./images/neutral.gif";
  109. break;
  110. }
  111. $i++;
  112. }
  113. $echofeed="";
  114. for ($ind2=1; $ind2<=$pages; $ind2++) {
  115. if ($_GET[pg]!=$ind2) {
  116. $echofeed .="<a href=\"yourfeedback.php?pg=$ind2\">
  117. $ind2</a>";
  118. if($ind2 != $pages) {
  119. $echofeed .= " | ";
  120. }
  121.  
  122. } ELSE {
  123. $echofeed .="$ind2";
  124. if($ind2 != $pages){
  125. $echofeed .= " | ";
  126. }
  127. }
  128. }
  129. $echofeed.="";
  130. }
  131.  
  132. // Calls the appropriate templates
  133.  
  134. include "header.php";
  135. include phpa_include("template_yourfeedback_php.html");
  136. include "footer.php";
  137. ?>

Thanks in advance,

Graham
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: Phpauction - View feedback error

 
0
  #2
Jul 1st, 2008
The 1st warning,
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/ozwww04/public_html/auction/yourfeedback.php on line 65
is because of this query.
  1. SELECT f.*,a.title FROM PHPAUCTIONXL_feedbacks f
  2. LEFT OUTER JOIN PHPAUCTIONXL_auctions a
  3. ON a.id=f.auction_id
  4. WHERE rated_user_id='$secid'
  5. ORDER BY feedbackdate DESC
  6. LIMIT $left_limit,$lines
Right after this query, you have $res=mysql_query ($sql); Instead, use $res=mysql_query ($sql) or die (mysql_error()); You will see why you are getting the warning.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 21
Reputation: Cobber is an unknown quantity at this point 
Solved Threads: 0
Cobber Cobber is offline Offline
Newbie Poster

Re: Phpauction - View feedback error

 
0
  #3
Jul 1st, 2008
Thanks Nav33n,

I tired that and now I just get a blank screen with the error message:

  1. You have an error IN your SQL syntax; CHECK the manual that corresponds to your MySQL server version for the RIGHT syntax to USE near '-5,5' at line 6

Don't know if that helps. Means nothing to me

2am now. Better turn this machine off.

Graham
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: Phpauction - View feedback error

 
1
  #4
Jul 2nd, 2008
Hmm.. Well, Thats because the limits are not being set properly.
  1. if ($_GET[pg]==0) $pg = 1;
  2. $lines = (int)$lines;
  3. if ($lines==0) $lines = 5;
  4. $left_limit = ($_GET[pg]-1)*$lines;
This block of code is the one causing you the problem. If you are in page1, $_GET['pg'] will not be set (ie., it will be null and not 0). I can't guarantee you that this will work, but you can try this.
  1. if ($_GET['pg']=="" || $_GET['pg']==0){
  2. $pg = 1;
  3. } else {
  4. $pg = $_GET['pg'];
  5. }
  6. $lines = (int)$lines;
  7. if ($lines==0) {
  8. $lines = 5;
  9. }
  10. $left_limit = ($pg-1)*$lines;

Cheers,
Naveen
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 21
Reputation: Cobber is an unknown quantity at this point 
Solved Threads: 0
Cobber Cobber is offline Offline
Newbie Poster

Re: Phpauction - View feedback error

 
0
  #5
Jul 2nd, 2008
Hi Naveen,

Thanks - that fixed it!

I have been making websites for seven years and usually manage to fumble my way through PHP mods by experimenting. This one was beyond me and I thought I might have SQL problems, which I won't even touch.

I appreciate your time and effort in looking at this for me.

I'm too old to learn any more new programming languages and sometimes think it's time to hang up my webmaster role. Things are just getting far too complicated for me now.

But your fix may help someone else in the future too, which is what is so good about Dani's forums.

Thanks again,

Graham
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: Phpauction - View feedback error

 
0
  #6
Jul 2nd, 2008
I'm too old to learn any more new programming languages
You are never too old to learn something
Anyways, the problem is fixed! So, Yaay!
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the MySQL Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC