shortysbest Posted June 19, 2010 Share Posted June 19, 2010 how can i make it so i can get this result in an array: $i = 3000; $i+3000 so it would print the following: 3000 6000 9000 12000 15000 etc.. Quote Link to comment https://forums.phpfreaks.com/topic/205230-i-increment-by-3000-instead-of-1/ Share on other sites More sharing options...
jcbones Posted June 19, 2010 Share Posted June 19, 2010 $i = $i + 3000; Quote Link to comment https://forums.phpfreaks.com/topic/205230-i-increment-by-3000-instead-of-1/#findComment-1074247 Share on other sites More sharing options...
kenrbnsn Posted June 19, 2010 Share Posted June 19, 2010 You would do: <?php $i = 3000; $i += 3000; echo $i; ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/205230-i-increment-by-3000-instead-of-1/#findComment-1074248 Share on other sites More sharing options...
shortysbest Posted June 19, 2010 Author Share Posted June 19, 2010 so for both of your scripts i either get 6000 6000 6000 6000 etc... or 6000 6001 6002 6003 etc... Quote Link to comment https://forums.phpfreaks.com/topic/205230-i-increment-by-3000-instead-of-1/#findComment-1074250 Share on other sites More sharing options...
trq Posted June 19, 2010 Share Posted June 19, 2010 Post your code. Quote Link to comment https://forums.phpfreaks.com/topic/205230-i-increment-by-3000-instead-of-1/#findComment-1074253 Share on other sites More sharing options...
shortysbest Posted June 19, 2010 Author Share Posted June 19, 2010 $b=0; $c=0; $d=200; $e=3000; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { ?> <script>$(document).ready(function(){ setTimeout(function () {$(".p<?php print $b++?>").fadeIn("slow");}, <?php print $d ?>; setTimeout(function () {$(".p<?php print $c++?>").fadeOut("fast");}, <?php print $e ?>); });</script> I want $d to go 200,400,600,800,1000, etc. and $e to go 3000,6000,9000,12000, etc. Quote Link to comment https://forums.phpfreaks.com/topic/205230-i-increment-by-3000-instead-of-1/#findComment-1074254 Share on other sites More sharing options...
jcbones Posted June 19, 2010 Share Posted June 19, 2010 $b=0; $c=0; $d=0; $e=0; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $d += 200; $e += 3000;?> <script>$(document).ready(function(){ setTimeout(function () {$(".p<?php print $b++?>").fadeIn("slow");}, <?php print $d ?>; setTimeout(function () {$(".p<?php print $c++?>").fadeOut("fast");}, <?php print $e ?>); });</script> Quote Link to comment https://forums.phpfreaks.com/topic/205230-i-increment-by-3000-instead-of-1/#findComment-1074255 Share on other sites More sharing options...
shortysbest Posted June 19, 2010 Author Share Posted June 19, 2010 oh.. i guess i had the wrong thing in my head as to what i needed, as those do print out the correct numbers as i asked for i made a mistake i need the array to end up looking similar to this: $(document).ready(function(){ setTimeout(function () {$(".p1").fadeIn("slow");}, 100); setTimeout(function () {$(".p1").fadeOut("fast");}, 5100); setTimeout(function () {$(".p2").fadeIn("slow");}, 5300); setTimeout(function () {$(".p2").fadeOut("fast");}, 8300); setTimeout(function () {$(".p3").fadeIn("slow");}, 8500); setTimeout(function () {$(".p3").fadeOut("fast");}, 11500); setTimeout(function () {$(".p4").fadeIn("slow");}, 11700); setTimeout(function () {$(".p4").fadeOut("fast");}, 14700); setTimeout(function () {$(".p5").fadeIn("slow");}, 14900); setTimeout(function () {$(".p5").fadeOut("fast");}, 17900); setTimeout(function () {$(".p6").fadeIn("slow");}, 18100); setTimeout(function () {$(".p6").fadeOut("fast");}, 21100); setTimeout(function () {$(".p1").fadeIn("slow");}, 21300); }); so i would need to add 200, then 3000, then 200, then 3000 to the same number. Quote Link to comment https://forums.phpfreaks.com/topic/205230-i-increment-by-3000-instead-of-1/#findComment-1074259 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.