Jump to content

mrbuter

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mrbuter's Achievements

Member

Member (2/5)

0

Reputation

  1. Change the "F" to an "M". http://us.php.net/manual/en/function.date.php
  2. Your cases are commented so php is getting confused Lines like " // Ascending by date posted (oldest first) case 5: " need to become // Ascending by date posted (oldest first) case 5:
  3. This is so weird.... check out this function: function addhttp($url) { if (!strstr("http://", $url)) { $url = "http://".$url.""; } return $url; } It's so easy.... It's meant to add an http:// prefix to a url if it does not already have one. If I enter www.google.com into the function, it outputs as http://www.google.com (correct!0 If I enter http://www.google.com into the function, it outputs as http://http//www.google.com Two things here: 1. why is it adding the prefix if it already has it? The code shouldn't let that happen...right? 2. Stranger still, not only does it ADD the prefix, but it proceeds to remove the colon from the original http:// which results in http://http// rather than http://http:// (which would still be wrong anyways) Any ideas what on earth is going on??
  4. This is so simple but I am having a hard time with it. Almost there! I want to have: www.example.com/user/me display what is currently shown in the ugly url: www.example.com/index.php?page=users&action=view&id=me I have this in htaccess: Options +FollowSymLinks RewriteEngine on RewriteRule user/(.*) index.php?page=users&action=view&id=$1 RewriteRule user/(.*)/ index.php?page=users&action=view&id=$1 And it works....except now all the images are broken. Anyone know how I can fix the images, or rather, stop images from getting redirected?
  5. Hi, quick question: are exec() commands vulnerable to timeouts? I'm going to use it to run a mysqldump with a $date command so that it doesn't overwrite (among other things). Then I'm going to make a cron to run it every 24 hours. I tried to append a date to the file using cron jobs and cPanel but it wasn't working...lol. So yeah, my question is if I use exec(), can the dump time out and leave me with a broken backup?
  6. Yes that's correct. When someone selects something in menu 1 it should call some kind of ajax function/script to populate menu 2 with the correct options.
  7. Hey guys..tried googling but I normally get more help here. I'm trying to setup a page where users select a date from a dropdown menu and then the server queries a database to return valid times of the day associated with the selected date. Think of it as a reservation system I guess. If user 1 reserves something for March 2nd 2009 @ 5PM then User 2 can't reserve it for that same time so the server shouldn't show "5PM" on the 2nd dropdown menu (and ideally will have like a +/- 2 hours along with that but that's unrelated and I know how to do that part). It's the ajax that's confusing me because I haven't really ever worked with it. Thanks in advance!
  8. I was under the impression that the values needed to be quoted. Anyways, any ideas how to make it work?
  9. //here we get all the ids for both the usergroups $bootyusers_19 = mysql_query(" SELECT userid FROM `user` WHERE `membergroupids` LIKE '%19%' "); $bootyusers_19_rows = mysql_num_rows($bootyusers_19); $bootyusers_20 = mysql_query(" SELECT userid FROM `user` WHERE `membergroupids` LIKE '%20%' "); $bootyusers_20_rows = mysql_num_rows($bootyusers_20); $bootytotal = $bootyusers_19_rows + $bootyusers_20_rows; //and we add them together (effectively our number of rows for later on) //now we need to implode both results into one set so we can make explode it and make it into an array $i = 0; $imploded = ""; while($row = mysql_fetch_array($bootyusers_19)){ // ($x=0;$x<$bootyusers_19_rows;$x++){ //and like $imploded += etc. if ($i == 0) { $imploded = $row['userid']; } else { $imploded .= "," . $row['userid'] . ""; } $i++; } //now we slap on the usergroup id =20 users onto the back of it...still imploding of course $i = 0; while($row = mysql_fetch_array($bootyusers_20)){ $imploded .= "," . $row['userid'] . ""; $i++; } //weee exploded $exploded = explode(",", $imploded); //now we do work for ($x=0;$x<$bootytotal;$x++) { //this query does leeches $query = mysql_query(" SELECT userid FROM post_thanks WHERE userid = $exploded[$x] ORDER BY userid DESC "); $rowsleech = mysql_num_rows($query); $array = mysql_fetch_array($query); //we're not using this anymore //this query does uploads $query = mysql_query(" SELECT postid FROM post AS post INNER JOIN thread AS thread ON(thread.threadid = post.threadid) WHERE post.userid = $exploded[$x] AND post.post_thanks_amount != 0 "); $rowsupload = mysql_num_rows($query); $array = mysql_fetch_array($query); //we're not using this anymore if ($rowsleech == 0) { $ratio = 0; } else { $ratio = round(($rowsupload / $rowsleech), 2); } $bootyuser[$x]['userid'] = $exploded[$x]; $bootyuser[$x]['leeches'] = $rowsleech; $bootyuser[$x]['uploads'] = $rowsupload; $bootyuser[$x]['ratio'] = $ratio; //now we echo just to make sure it works (which it does)...........but how the hell do we sort it echo "Userid: " . $bootyuser[$x]['userid'] . ", number of leeches: " . $bootyuser[$x]['leeches'] . " and number of uploads: " . $bootyuser[$x]['uploads'] . " so the ratio for this user is " . $bootyuser[$x]['ratio'] . "<br>"; } That's the rest of it in case it helps.
  10. I forgot to add, in my code $explode[$x] is equal to the user's userid.
  11. First things first...my end goal is sorting some numbers I calculated from lowest to highest. From what I understand in order to do this I need to place them into an array first. One other thing though, the numbers being calculated have an id related to them (it's a ratio for users) The numbers are calculated through a for loop. After each iteration the number is stored in $ratio. I can successfully echo the numbers corresponding to the users so I'm almost there, now I just need to sort it. The problem is I really don't know how to put the information into an array. I tried doing something like this but it didn't worrk: if ($x == 0) { $info = Array( $x => Array ( "" . $explode[$x] . "", "" . $ratio . "" ) } else if($x != $nbr_rows - 1) { $info .= $x => Array ( "" . $explode[$x] . "", "" . $ratio . "" ), } else { $info .= $x => Array ( "" . $explode[$x] . "", "" . $ratio . "" ) ); } So say, after it completes all 3 iterations (realistically there will be about 70) it would look like this: $info = Array( [0] => Array ( [0] => 238492 [1] => 0.21 ) [1] => Array( [0] => 100 [1] => 0.32 ) [2] => Array( [0] => 819 [1] => 0.87 ) ) That way I would have the ratio that goes along with a unique id. By all means, if you have any other way that I could sort these out that would be absolutely fine. Thanks in advance.
  12. What is the best way to do this? I made a script which makes the tables etc. Works fine. Adding info to them works well too (INSERT INTO). However....I have one table which needs a _MASSIVE_ ammount of data put into it. (42,000 some rows). On my localhost server I get a timeout error (set to 30 seconds) but what would you recommend? Splitting it up wouldn't be too useful since it would probably be like 200 steps lol. PHP has no notion of time right? So I can't add like any "wait" commands every 100 or so insert queries?
×
×
  • 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.