Jump to content

jck

Members
  • Posts

    91
  • Joined

  • Last visited

    Never

Everything posted by jck

  1. jck

    question

    for my jokes site when i click next button i want to make only the text of the joke reload rather than the whole page like header and footer how do i do it
  2. SELECT ItemID from dd_items WHERE ItemCategory = '$a1[itemCategory]' AND ItemID < '$ItemID' AND ItemStatus = 'approved' LIMIT 1 this is always taking me to the last item of a category.... i dont understand how
  3. $rnextcat = mysql_query("SELECT CategoryID from dd_categories WHERE CategoryID > '$a1[itemCategory]' ORDER by CategoryID DESC LIMIT 1"); $rnc = mysql_fetch_array($rnextcat); $rncid = mysql_query("SELECT ItemID from dd_items WHERE ItemCategory = '$rnc['CategoryID']' AND ItemStatus = 'approved' ORDER by ItemID DESC LIMIT 1"); $rowncid = mysql_fetch_array($rncid); $next = $rowncid['ItemID']; to fetch the first item of the next category....... it seems ok but its not worrking
  4. there is no field for rating in the table ecause it is not storing decimals so on the pages its dynamically calculated so i need to order by ratesum divided by ratecount
  5. suppose in a table there are ratesum and ratecount and rating is ratesum/ratecount how do i sort them in descending order of rating
  6. So people call that leeching; some call it bandwidth theft. since the free host im using has bandwidth limit i want to store some images in google pages
  7. i need it to get an image from another site not the same one
  8. i want the image to be one in a link stored in a variable like http://www.site.com/pic.gif stored in $var how do i do it echo "<td align=center valign=top width=100><center><img src=\"../items_images/$NewImageName\" width=100></center></td>\n\t<td>";
  9. im planning to use rate sum if two jokes have same rate avg..... but how do i transfer from old table......
  10. thanks for the reply xyn but that had already been solved please read the further ones to see the new problem
  11. i guess i can write a while loop and run it once..... but the problem in that is some ItemID's in the jokes database dont exist
  12. oops my old system of rating was to store all votes in 1 table with itemid, username and rating i wanted to make it like this for some reasons..... now i have a huge problem there are already 60 jokes and many votes stored in the old method any way to transfer them directly of should i feed manually ???
  13. $r2 = mysql_query("select RateSum,RateCount from dd_items where ItemID = '$_POST[itemID]'"); $rows = mysql_fetch_array($result); $rc = $rows['RateCount']; $rs = $rows['RateSum']; $rc = $rc + 1; $rs = $rs + '$_POST[rr]'; $nrate = $rs/$rc; UPDATE dd_items SET RateSum = '$rs' ,RateCount = '$rc' , Rating = '$nrate' WHERE = ItemID '$_POST[itemID]';
  14. i think ur query takes to one with highest sum of votes.... if i am correct i need it to go to one with next highest avg votes
  15. SELECT ItemID, avg(rating) as mr from dd_rating WHERE mr <= $Item_Rating group by ItemID ORDER by mr DESC LIMIT 1
  16. i have about 60 records in a table and in each there is a column called itemtype which is empty i need to update all of them to T how can i do it easily
  17. Working code <? $rnext = mysql_query("SELECT * from dd_items WHERE ItemCategory = '$a1[itemCategory]' AND ItemID < '$ItemID' AND ItemStatus = 'approved' ORDER by ItemID DESC LIMIT 1"); $rownext = mysql_fetch_array($rnext); if ($rownext['ItemID'] != 0) { $next = $rownext['ItemID']; } else { $next = $ItemID; } $rprev = mysql_query("SELECT * from dd_items WHERE ItemCategory = '$a1[itemCategory]' AND ItemID > '$ItemID' AND ItemStatus = 'approved' ORDER by ItemID DESC LIMIT 1"); $rowprev = mysql_fetch_array($rprev); if ($rowprev['ItemID'] != 0) { $prev = $rowprev['ItemID']; } else { $prev = $ItemID; } ?> <a href="/view.php?ItemID=<?=$prev?>"><img style="border: 0px solid ; width: 50px; height: 50px;" alt="Previous Joke in this category" src="images/prev.gif"></a><a href="view.php?ItemID=<?=$next?>"><img style="border: 0px solid ; width: 50px; height: 50px;" alt="Next Joke in this category" src="images/next.gif"></a>
  18. hey i did in a easier way if ($id != 0) original code else //no joke
  19. $rnext = mysql_query("SELECT * from dd_items WHERE ItemCategory = '$a1[itemCategory]' AND ItemID < '$ItemID' ORDER by ItemID DESC LIMIT 1"); $rownext = mysql_fetch_array($rnext); $next = $rownext['ItemID']; $rprev = mysql_query("SELECT * from dd_items WHERE ItemCategory = '$a1[itemCategory]' AND ItemID > '$ItemID' ORDER by ItemID DESC LIMIT 1"); $rowprev = mysql_fetch_array($rprev); $prev = $rowprev['ItemID']; <a href="/view.php?ItemID=<?=$prev?>"><img style="border: 0px solid ; width: 50px; height: 50px;" alt="Previous Joke in this category" src="images/prev.gif"></a><a href="view.php?ItemID=<?=$next?>"><img style="border: 0px solid ; width: 50px; height: 50px;" alt="Next Joke in this category" src="images/next.gif"></a>
  20. i have made a script with some links so when i point sometimes it says view.php?id=someno but sometimes when there are no more records it just view.php?id= i want to add an if clause to echo that no such jokes exist in that case i have tried id == '0' and id == ' ' snd id== '' but none of them work can i do anything for it??
×
×
  • 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.