Jump to content

newb

Members
  • Posts

    454
  • Joined

  • Last visited

Everything posted by newb

  1. OK this is the rest then. for ($i = 1; $i <= 5; $i++) { $s = $i - 1; if (!empty($avi) && $do == 0) { $varname = "avi$s"; } else if (!empty($mkv) && $do == 1) { $varname = "mkv$s"; } else if (!empty($ogm) && $do == 2) { $varname = "ogm$s"; } else if (!empty($mp4) && $do == 3) { $varname = "mp4$s"; } $file_ext = $$varname; if (!empty($file_ext)) { $src[$i] = 'SRC '.$i.': <a target="_blank" href="'.SITE_URL.'download/'.$cid .'/'.$seotitle.'-'.substr($varname,0,-1).'-'.$id.'/index'.$i.'.html">'.srcinfo($file_ext,'file',$vbid,$id,$s,$do).'</a>'; $size[$i] = srcinfo($file_ext,'size',$vbid,$id,$s,$do); $rawlink[$i] = srcinfo($file_ext,'rawlink',$vbid,$id,$s,$do); } }
  2. I don't know why, the foreach should exhaust after it traverses all the table columns. Are you sure it's not errorring out? *NOTE: The variable names changed from your original code to mine. There is an underscore separating the letters & numbers, which are the array keys. Try putting error reporting on an echoing out the values to see where it stops (if it does): <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); $query = exec_mysql_query("SELECT * FROM sources WHERE cat_id = '$cid' AND id = '$id' LIMIT 1"); $row = mysql_fetch_assoc($query); foreach($row as $value => $key) { $$key = $value; echo "$key => $value <br/>"; } ?> im getting something now thanks to the echo u added in, but after that the page takes forever to load also, i let the page load finally but all of my links are looking like this: http://www.filehosting.com/mp4_4 http://www.filehosting.com/mp4_4 http://www.filehosting.com/mp4_4 http://www.filehosting.com/mp4_4 http://www.filehosting.com/mp4_4 http://www.filehosting.com/mp4_4 also i dont know why but it looks like this at the top: any suggestions?
  3. i dont know why, but that foreach function causes serious load time issues to the point where the page will not load beyond that point. while does not do this. this didn't work at all, im guessing probably because its enwrapped around the while statements, while the rest of my code is not. any other suggestions?
  4. $query = exec_mysql_query("SELECT * FROM sources WHERE cat_id = '$cid' AND id = '$id' LIMIT 1"); while ($row = mysql_fetch_assoc($query)) { $avi0 = $row['avi_0']; $avi1 = $row['avi_1']; $mkv0 = $row['mkv_0']; $mkv1 = $row['mkv_1']; $ogm0 = $row['ogm_0']; $ogm1 = $row['ogm_1']; $mp40 = $row['mp4_0']; $mp41 = $row['mp4_1']; } this is my code atm. it is used to store file sources information inside. however, i am always expanding one format or the other (example avi or mkv). how can i make this code shorter so that i dont need to keep adding more variables whenever i want to expand it? any ideas?
  5. thanks, that above code works, but it ignores the 'class="username online"' bit. i included it at the end
  6. <a href="user/237960-admin" class="username online" how can i make it so i can grab only the username out of this?
  7. anyone have any ideas on how i could check if a user has a GM script installed when they visit a page on my website?
  8. scratch that. this works alot better than the above query used: $query = mysql_query("SELECT userid,username, dl_sumtotal, rank FROM (SELECT userid,username, dl_sumtotal, @rownum := @rownum + 1 AS rank FROM vb_user JOIN (SELECT @rownum := 0) r ORDER BY dl_sumtotal DESC) x WHERE userid = $uid");
  9. nvmd i figured it out thanks anyway SELECT username, dl_sumtotal, @curRow := @curRow +1 AS row_number FROM `vb_user` JOIN ( SELECT @curRow :=0 )r ORDER BY dl_sumtotal DESC LIMIT 0 , 30
  10. I have an SQL query: SELECT username, dl_sumtotal FROM `vb_user` ORDER BY dl_sumtotal DESC LIMIT 0 , 30 Right now, its results display like this: username3: 500 username1: 400 username2: 300 How can I give these results a numbered column so it displays like this: 1: username3: 500 2: username1: 400 3: username2: 300 I would like to output that number in my PHP script. thanks for any help.
  11. ah...works like a charm, thanks!
  12. yeah that doesnt work because it counts the results before it was grouped by IP, so the occurences are way off..i need to count the results after its been grouped by IP.
  13. i know that but thats not what im trying to do. i need to count the number of occurences for the first column. for example, im trying to get output like this..: 784: 2 occurences 754: 1 occurence
  14. in my mysql query, after the results have been grouped is there any way to count the results? i have a end result like this: 784 | x.x.x.x 754 | x.x.x.x 784 | x.x.x.x so how can i count the first column after its been grouped by IPs? here is my query: SELECT * FROM `hits`GROUP BY ip
  15. SELECT *,from_unixtime(date,'%Y-%m%-%d') as date1 FROM items WHERE disabled != 1 GROUP BY cat_id WHERE date1 = DATE_SUB(curdate(), INTERVAL 1 DAY) ORDER BY date desc not working? why?
  16. there's over 10,000 rows of data in the table so there will always be results. im trying to get the code to output whatever the maximum results there is from the query given, but always output a minimum number of 5 results at the least (it wont always output 5 results because some days will not have any rows, so it should look to the next days until a minimum of atleast 5 results are output)
  17. ok here is my code: it has a counter variable $i at the start which basically acts as a maximum cutoff for how much data can be output. i have this variable set at 5. how can i make it so that it doesnt cut off the results (outputs the full 7 days worth of results if available), but ALWAYS outputs a minimum of 5 results? $now = $now-(7*24*60*60); // Display 7 Days of Results $query = mysql_query("SELECT * FROM table WHERE date >= '$now' ORDER BY max(date) desc"); $i = 0; while ($row = mysql_fetch_assoc($query)) { $cid = $row['cat_id']; $title = $row['name']; $seoname = cleanurl($title,0); $img = 'images/'.$seoname.'.jpg'; if (!file_exists($img)) { $img = ''; } else { $img = 'images/'.$seoname.'.jpg'; } if (!empty($img)) { $i++; } if (!empty($img) && $i <= 5) { // Always show ATLEAST 5 results echo '<img src="'.$img .'" style="width:528px;" alt="" />' . "\n"; } } Please help and look at my code..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.