Hello all, i need some help from you guys. I've created an array, for example: $arrayName = array ("my text a","my text b","my text c"); suppose i have 20 elements in my array.. i used this method to display my array: $value = current ($arrayName ); echo "$value<br>"; $value = next ($arrayName ); echo "$value<br>"; what i want want now is that, i want to display this array values on different pages. Like, it display 0 to 10 array values on first page and 10 to 20 values on second page. I hope you guys understand what i want... If anyone can help quick... please reply here. Thank you!!
$start = 0; // Could be 10, 20... whatever the start number of the record set $finish = 10 // 20, 20 etc... The number of records you want to display for ( $count = $start; $count < $arrayName || $count = $finish; $count++ ) { echo $arrayName[$count]; }
well thanks for the script but im facing some problem... the page is keep loading but not showing the stuff... here is what i have added but the page is keep loading.. please check this out.. $firstpoint = "0"; // Could be 10, 20... whatever the start number of the record set $endpoint = "10"; // 20, 20 etc... The number of records you want to display for($count = $firstpoint; $count < $friend || $count = $endpoint; $count++) { echo $friend[$count]; }; thanks for quick help..
$start = 0; //We'll just set it at 0 but you might like to get this from a GET variable $length = 10; $sliced_array = array_slice($arrayName, $start, $length); foreach ($sliced_array as $item) { echo $item; } PHP:
Lol, I find that a little bit offensive, to be honest. It's amazing how you expect free help, and on top of that expect that it works flawlessly on first try. I'm not going to set up everything locally to test a 5 line script. So, sorry if I wasted 5 seconds of your time.
no probs.. Well, i need some more help if you could solve this one.. I'm using the rating script for my website files & i manually gave the file names to the rating script.. Please check the following script. the thing i highlighted in red.. i want to display it in array but it doesn't work.. when i try to echo it using variable, it works but i want it to add in all of my files on one page... so i need to put this thing here where it is highlighted.. any solution??
I'm not at all sure I know what you're trying to achieve here. If you could go into a bit more of the background and/or show us some of the code surrounding this it might help. On the off chance I'm not totally confused though try putting curly brackets around the function - {rating_bar('02','5')}
well, i think we cannot do that.. I changed my idea now.. What i was trying to do: i wanted to display tables and their elements using array & also i wanted to load a variable inside an array... Now im simply using it with dreamweaver & linking to php for array work.. Thank you..