Jump to content

Cultureshock

Members
  • Posts

    42
  • Joined

  • Last visited

Everything posted by Cultureshock

  1. Basically, I have a fb/twitter status-like system on my site. However I don't want every member to be clogging my databases with 1000 statuses each. Say I only want each member to have 150 statuses at a time. How would I go about deleting the oldest row every time someone posts a 151st status? (ie delete the last status to allow room for a new one.) I'm afraid if my novice hands attempt something I'll end up getting everything deleted or something. Table: userid, statustext
  2. I'm aware. Now if someone who knows how to do that would help me...
  3. Exactly why I'd want it to be a compared/ percentage size and not a standard/ fixxed size...
  4. I assume most people know how tag clouds work, where the tags most used are bigger and the least used tags are smaller. This is the basic function of my member cloud. I created the code below from scratch, however I'd rather the data compare itself to each other and have the biggest poster the biggest font size (40px) and the smallest poster the smaller font size (15px) and everyone in between where they should be. Assume the limit was 5 instead of 20 as in the code. If: Member 1 has 10 posts Member 2 has 11 posts Member 3 has 12 posts Member 4 has 13 posts Member 5 has 14 posts I'd want Member 1 to be 15px and member 5 to be 40px, and everyone in between where they should be (I assume this would involve percentages.) A more accurate/ more likely example: Member 1 has 50 posts Member 2 has 2 posts Member 3 has 72 posts Member 4 has 90 posts Member 5 has 54 posts I'd want Member 2 to be 15px and member 4 to be 40px, and everyone in between where they should be, regardless of what there actual post count is. I just want smallest smallest and largest largest. $allmembersresult = mysql_query("SELECT * FROM users ORDER BY RAND() DESC LIMIT 20"); while($row = mysql_fetch_array($allmembersresult)){ $newuid = $row['id']; $newusername = $row['username']; $ifadmin = $row['admin']; $postnumresult = mysql_query("SELECT * FROM content WHERE uid='$newuid' GROUP BY cid"); $postnum = mysql_num_rows($postnumresult); ?> <a href="/us.php?find=<?php echo $newuid;?>" style="text-transform:none; <?php if($postnum == 0){ echo "font-size:15px;"; }else if($postnum > 0 && $postnum <= 5){ echo "font-size:20px;"; }else if($postnum > 5 && $postnum <= 15){ echo "font-size:30px;"; }else if($postnum > 15 && $postnum <= 30){ echo "font-size:40px;"; }; /* etcetc */ if($ifadmin == "yes"){ echo "font-style:italic;font-family:georgia;"; }; if($uid == "$newuid"){ echo "color:green;"; }; ?> "> <?php echo $newusername." (".$postnum.")"; ?> , </a> <?php }; ?> I'd be happy to elaborate if need be! thanks!
  5. But how would that help if I have multiple ages? (i.e. grab all the pets from table 2 who's owners in table 1 are 18, 19, 23, or 9.) The data searched for has to be dynamic.
  6. How might I take a set of data from table 1 and apply it to table 2? For instance. Table 1: id*, name, age Table 2: id, pet How would I be able to view all the pets of people who are 18 (if 'id' is unique in table 1 and shared by all the pets owned by that person in table 2)? does that make sense? >.<
  7. It worked Thanks.
  8. Does anyone know how to?
  9. All that did was echo numbers 1-11 before each row like this: 1 2 3 4 5 6 7 8 9 10 11 *data* Am I supposed to be changing something to match something in my mysql? MySQL version 5.0.85 PHP version 5.2.11
  10. Yeah, I fixed that earlier. It didn't work.
  11. If it uses mysql then the content wouldn't carry over.
  12. Sorry, but it didn't work. It posted *do something every 4* before each set of data, not every four sets of data.
  13. GOTTA CATCH 'EM ALL, POKEMON! Sorry. Theme song moment. I have nothing to contribute, I just thought I'd throw some thumbs up. Sorry to intrude!
  14. Thanks. Sorry I didn't look. I was kind of busy coding other aspects of my project. Thanks again.
  15. If I have a while statement echo all the applicable data in a mysql table, how can I insert everything after every four rows, such as a div?
  16. Thanks! That's exactly what I was looking for. How did I not learn that anywhere? X.X
  17. (Basically this is for paginating data)... Say I have a list of data 10 rows long, but I only want to show data rows 3-8 in my while statement. I use ?limit=5 (aka $limit = $_GET['limit']; ) to set the mysql query LIMIT $limit. But obviously this code shows rows 1-5. If I use ?page=3&limit=5 (aka $limit = $_GET['limit'];$page = $_GET['page']; ), how would I print out only data rows starting at the third row? Is this something in the query or php?
×
×
  • 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.