Methos Usergallery Help

Started on the old forum in May 2008 · view the original in the archive · old links redirect here

4 replies · 580 views · started 18 years ago · 1 min read

2 participants
jayasanka Developer · 128 posts #1

in user gallery comment page i cannot go to second page.i got error.plz help me to fix it. thankz in advance.

Error 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 1

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/public_html/wap/web/usergallery.php on line 411

comment php code.

else
if($action=="comments")
{

  addonline(getuid_sid($sid),"User Gallery","");
 echo "<head>";
      echo "<title>COMMENTS</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">[size="1"]";
  echo "
";
  echo "[/size]</p>";
      //////ALL LISTS SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_usergallery_rating WHERE imageid='".$whoimage."' and commentsyn ='Y'"));
    $num_items = $noi[0]; //changable
    $items_per_page= 5;
    $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;
    
    $uidinfo = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_usergallery WHERE id='".$whoimage."'"));
    $uid = getuid_sid($sid);

    
    $sql = "SELECT rating, comments, byuid, time, commentsreply, id  FROM ibwf_usergallery_rating WHERE imageid ='".$whoimage."' and commentsyn ='Y' ORDER BY time DESC LIMIT $limit_start, $items_per_page";

    echo "

";
    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
   {
    while ($item = mysql_fetch_array($items))
    {
        
    if(isonline($item[2]))
  {
    $iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
    
  }else{
    $iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
  }
    if(strlen($item[1])>1){
         
      $snick = getnick_uid($item[2]);
      $lnk = "[size="1"]<a href=\"index.php?action=viewuser&who=$item[2]&sid=$sid\">$iml$snick:</a> [b]$item[0]/10[/b][/size]";
      echo "$lnk
[size="1"]";
      $bs = date("d/m/y",$item[3]);
      $text = parsepm($item[1], $sid);
      if(($uid==$uidinfo[0]) and (strlen($item[4])<1))
      {
        $replylink = "<a href=\"usergallery.php?action=commentreply&sid=$sid&id=$item[5]\">Reply to Comment</a>
[i]$bs[/i]";
      }else{
        $replylink = " [i]$bs[/i]";
      }
      echo "$text";
      if(strlen($item[4])>1)
      {
      $text1 = parsepm($item[4], $sid);
      echo "
[b][i]Reply:[/i] $text1[/b]";
      }
      echo "
$replylink

";
      echo "[/size]";
    }
    }
    }
    echo "</p>";
    echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"usergallery.php?action=$action&page=$ppage&sid=$sid&who=$who\">«Prev</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"usergallery.php?action=$action&page=$npage&sid=$sid&who=$who\">Next»</a>";
    }
    echo "
$page/$num_pages
";
    if($num_pages>2)
    {
      $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
        $rets .= "<anchor>[GO]";
        $rets .= "<go href=\"usergallery.php\" method=\"get\">";
        $rets .= "<postfield name=\"action\" value=\"$action\"/>";
        $rets .= "<postfield name=\"who\" value=\"$who\"/>";
        $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
        $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
        $rets .= "</go></anchor>";

        echo $rets;
    }
    echo "</p>"; 
  ////// UNTILL HERE >> 
    echo "<p align=\"center\">";
   echo "

<a href=\"usergallery.php?action=main&sid=$sid\">«Back to Gallery</a>
";
   
  echo "
<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
  echo "</body>";
}
Guest #2

just change THIS:

if($page>1)
{
  $ppage = $page-1;
  echo "<a href=\"usergallery.php?action=$action&amp;page=$ppage&amp;sid=$sid&amp;who=$who\">«Prev</a> ";
}
if($page<$num_pages)
{
  $npage = $page+1;
  echo "<a href=\"usergallery.php?action=$action&amp;page=$npage&amp;sid=$sid&amp;who=$who\">Next»</a>";
}

TO THIS:

if($page>1) { $ppage = $page-1; echo "<a href="gallery.php?action=$action&sid=$sid&page=$ppage&whoimage=$whoimage">« Prev</a> "; } echo " $page/$num_pages "; if($page<$num_pages) { $npage = $page+1; echo "<a href="gallery.php?action=$action&sid=$sid&page=$npage&whoimage=$whoimage">Next »</a>"; }

metulj Super moderator Principal · 1,726 posts #3

in user gallery comment page i cannot go to second page.i got error.plz help me to fix it. thankz in advance.

Error 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 1

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/public_html/wap/web/usergallery.php on line 411

comment php code.

else
if($action=="comments")
{

  addonline(getuid_sid($sid),"User Gallery","");
 echo "<head>";
      echo "<title>COMMENTS</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
...............
.................
....................
}

i dont understand.. i might be wrong... but i dont know why have you posted your ''comment.php'' while you get mentioned in error line that problem is in ''usergallery.php'' ?

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

jayasanka Developer · 128 posts #4

just change THIS:

if($page>1)
{
  $ppage = $page-1;
  echo "<a href=\"usergallery.php?action=$action&amp;page=$ppage&amp;sid=$sid&amp;who=$who\">«Prev</a> ";
}
if($page<$num_pages)
{
  $npage = $page+1;
  echo "<a href=\"usergallery.php?action=$action&amp;page=$npage&amp;sid=$sid&amp;who=$who\">Next»</a>";
}

TO THIS: if($page>1) { $ppage = $page-1; echo "<a href="gallery.php?action=$action&sid=$sid&page=$ppage&whoimage=$whoimage">« Prev</a> "; } echo " $page/$num_pages "; if($page<$num_pages) { $npage = $page+1; echo "<a href="gallery.php?action=$action&sid=$sid&page=$npage&whoimage=$whoimage">Next »</a>"; }

it wrkz bro..thnkz a lot ..... External image (may be gone) External image (may be gone)

Guest #5

shot, no problem. anything to help.

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close