943,630 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Marked Solved
  • Views: 1663
  • MySQL RSS
Jun 30th, 2008
0

Phpauction - View feedback error

Expand Post »
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:

MySQL Syntax (Toggle Plain Text)
  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:

MySQL Syntax (Toggle Plain Text)
  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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Cobber is offline Offline
21 posts
since Mar 2005
Jul 1st, 2008
0

Re: Phpauction - View feedback error

The 1st warning,
Quote ...
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.
mysql Syntax (Toggle Plain Text)
  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.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Jul 1st, 2008
0

Re: Phpauction - View feedback error

Thanks Nav33n,

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

MySQL Syntax (Toggle Plain Text)
  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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Cobber is offline Offline
21 posts
since Mar 2005
Jul 2nd, 2008
1

Re: Phpauction - View feedback error

Hmm.. Well, Thats because the limits are not being set properly.
php Syntax (Toggle Plain Text)
  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.
php Syntax (Toggle Plain Text)
  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
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Jul 2nd, 2008
0

Re: Phpauction - View feedback error

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Cobber is offline Offline
21 posts
since Mar 2005
Jul 2nd, 2008
0

Re: Phpauction - View feedback error

Quote ...
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!
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
May 31st, 2010
0
Re: Phpauction - View feedback error
Just letting you know that I had the same problem with PHPAuction and after doint some research, I came across your site and saw the fix. Your solution was an absolute fix. Thank you so much and here's wishing you more power. Now, I only have to worry about editing footnote.php. PHPAuction should hire you as a consultant.
Last edited by Ezzaral; May 31st, 2010 at 4:29 pm. Reason: Removed unnecessary code tags.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pcfix609 is offline Offline
1 posts
since May 2010

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: How to insert same value in all rows at once?
Next Thread in MySQL Forum Timeline: Create Table Error 1064





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC