Jump to content

nclemale

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

nclemale's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. firstly thanks for your informative help. posted this on 2 other forums also and just got negative comments. so thanks . and secondly i resolved the problem without even using a loop. and i also changed $row to $item .
  2. hi . am editting a code i have on a gallery script. so its has a download function for users and also a hits counter. my hits counter and downloading code works perfect but am struggling with the while loop and how to get it so the link shows under each picture . At present its showing the first picture then the download links for all 5 pictures that is displaying. quick pictorial example below as to what the output is . [] <<< pic 1 link for pic 1 link for pic 2 link for pic 3 link for pic 4 link for pic 5 [] <<< pic 2 [] <<< pic 3 [] <<< pic 4 [] <<< pic 5 Thats what the page looks like . I do like to try to give you guys as much info as possible lol if($action=="males") { addonline(getuid_sid($sid),"Male Gallery",""); echo "<head>"; echo "<title>Gallery Pics</title>"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">"; echo "</head>"; echo "<body>"; echo "<p align=\"center\"><small>"; echo "<i><b><u>Male Users From $sitename</u></b></i>"; echo "<br/><br/>"; echo "</small></p>"; //////ALL LISTS SCRIPT << $uid1 = getuid_sid($sid); $mid = $_GET["mid"]; if($page=="" || $page<=0)$page=1; $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM dave_usergallery WHERE sex='M'")); $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; $sql = "SELECT uid, id, imageurl FROM dave_usergallery WHERE sex='M' ORDER BY id DESC LIMIT $limit_start, $items_per_page"; ///////////////////// part of the added code also. $result = mysql_query($sql) or die("Error: " . mysql_error()); //// echo "<p>"; $items = mysql_query($sql); echo mysql_error(); if(mysql_num_rows($items)>0) { while ($item = mysql_fetch_array($items)) { $sql = "SELECT rating FROM dave_usergallery_rating WHERE imageid='".$item[1]."'"; $imginfo = mysql_query($sql); echo mysql_error(); if(mysql_num_rows($imginfo)>0) { while ($imginfos = mysql_fetch_array($imginfo)){ $ratingtotal = $ratingtotal + $imginfos[0];} } if($totalcomments<1){$totalcomments=0;} $norm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM dave_usergallery_rating WHERE imageid='".$item[1]."'")); if ($norm[0]>0){ $rating = ceil($ratingtotal/$norm[0]); }else{$rating=0;} $rated = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM dave_usergallery_rating WHERE byuid='".$uid1."' and imageid ='".$item[1]."'")); $totalcomments = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM dave_usergallery_rating WHERE imageid ='".$item[1]."' and commentsyn ='Y'")); $userinfo = mysql_fetch_array(mysql_query("SELECT name FROM dave_users WHERE id='".$item[0]."'")); echo "<a href=\"index.php?action=viewuser&who=$item[0]&sid=$sid\"><b><i><u>$userinfo[0]</u></i></b></a><small>"; if(canratephoto($uid1, $item[0]) and ($rated[0]==0)) { echo "<br/><a href=\"usergallery.php?action=rate&sid=$sid&whoimage=$item[1]\">Rate This Photo</a>"; } if(ishost(getuid_sid($sid))||((isowner(getuid_sid($sid))||((isheadadmin(getuid_sid($sid))))))) { echo " / <a href=\"usergallery.php?action=del&sid=$sid&whoimage=$item[1]\">Del</a>"; } if($uid1==$item[0]) { echo " / <a href=\"usergallery.php?action=del&sid=$sid&whoimage=$item[1]\">Del</a>"; } if($uid1==$item[0]) { echo "<br/><a href=\"genproc.php?action=upavg&sid=$sid&avsrc=$item[2]\">Use As profile pic</a>"; } echo "</small><br/><img src=\"$item[2]\" alt=\"$userinfo[0]\"/><br/>"; echo "<small>Rating: $rating/10 (<a href=\"usergallery.php?action=votes&sid=$sid&whoimage=$item[1]\">$norm[0]</a> Votes)<br/><a href=\"usergallery.php?action=comments&sid=$sid&whoimage=$item[1]\">Comments</a>($totalcomments[0])"; echo "</small><br/><a href=\"$item[2]\" alt=\"$userinfo[0]\"/>Download<br/>"; ////////////////////////my problem part while($row = mysql_fetch_array($result)){ echo "<br/><a href=\"getpics.php?file=$row[id]&sid=$sid\">Download test</a>"; <br/>"; } //////////////////////// echo "</small><br/><br/>"; $ratingtotal = 0; } } echo "</p>"; echo "<p align="center\">"; if($page>1) { $ppage = $page-1; echo "<a href=\"usergallery.php?action=males&sid=$sid&page=$ppage\">«Prev</a> "; } if($page<$num_pages) { $npage = $page+1; echo "<a href=\"usergallery.php?action=males&sid=$sid&page=$npage\">Next»</a>"; } echo "<br/>$page/$num_pages<br/>"; if($num_pages>2) { $rets = "<form action=\"usergallery.php\" method=\"get\"><p align=\"center\">"; $rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"3\"/>"; $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>"; $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>"; $rets .= "<input type=\"hidden\" name=\"view\" value=\"$view\"/>"; $rets .= "<input type=\"Submit\" value=\"Go To Page\" Name=\"Submit\"/></form>"; echo $rets; } echo "</p>"; ////// UNTILL HERE >> echo "<p align=\"center\">"; echo "<br/><br/><a href=\"usergallery.php?action=main&sid=$sid\">«Back to Gallery</a><br/>"; echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>"; echo "Home</a>"; echo "</p>"; echo"</body>"; exit(); i have pointed out the bits i have added and tried to work it out. i also appreciate the codings not that clean. am no coder this was given to me. but i can add bits here and there to things . Its just am stuck on this . really hope u guys can help.
  3. links taking me to your server default page.
  4. thats sounds complicated .could i not just make a function in my main file that runs all my other parts of site . and if so where would i even start. ?
  5. ok after trying a few more things i finally sussed it so it carries the jackpot to the user that wins . all i did is this $jack = mysql_fetch_array(mysql_query("SELECT jackpot FROM lotto ")); mysql_query("UPDATE users SET plusses=plusses+'$jack[0]' WHERE id='".$winner."'"); simple yes but i am just learning. ok is there a way i can add time coding in this so lets say it all gets reset every hour and it randomly picks a winner on its own. ??
  6. hi guys . been messing around with some codes and am trying to make a small code for my site so when they click on play it deducts site points off them and inserts it into a hourly jackpot that is won randomly .first off is i cant manage to carry the jackpot to the winning user .at present i have it set at 1000 points which works fine . this is the code that when they clck play $lot = mysql_fetch_array(mysql_query("SELECT jackpot FROM lotto ")); $res=mysql_query("UPDATE lotto SET jackpot='".($lot[0]+50)."'"); $res=mysql_query("UPDATE users SET lotto='1' WHERE id='".$uid."'"); $ugpl = mysql_fetch_array(mysql_query("SELECT plusses FROM users WHERE id='".$uid."'")); $ugpl = $ugpl[0] - 50; mysql_query("UPDATE users SET plusses='".$ugpl."' WHERE id='".$uid."'"); if($res){ echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Entered lotto successfully<br/>"; }else{ echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Error<br/>"; } and this is the winning code for when a user is chosen . $rpgd = mysql_query("SELECT id, lotto FROM users ORDER by lotto DESC LIMIT 1"); while($rpgds=mysql_fetch_array($rpgd)) { $winner =$rpgds[0]; $winner2 =$rpgds[1]; } $unick2 = getnick_uid($winner); mysql_query("UPDATE users SET plusses=plusses+'1000' WHERE id='".$winner."'"); mysql_query("UPDATE users SET lotto='0'"); mysql_query("UPDATE lotto SET jackpot='0'"); echo"$unick2 has won the jackpot "; as you can see the line that has plusses=plusses+'1000' is the part i need to get right. once i have this sorted i will need help with the time part of it. thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.