Portal Home > Knowledgebase > Articles Database > php help loop help
php help loop help
Posted by ti_nhatrang, 02-06-2010, 12:27 AM |
Hello all,
I want to have a script that outputs the sample result below for me, if you could help I would really appreciate it:
[pictures1]
user=9545645
pass=sdf345tfdf
[pictures2]
user=9545645
pass=sdf345tfdf
[pictures3]
user=9545645
pass=sdf345tfdf
Where do I even begin to get this done? I want to be able to set my pictures starting amount, say if I say start with 5, than it should do 5 thru the amount I inputted...
Thanks for any kind of help I may get with this thread.
|
Posted by SpaceWalker, 02-06-2010, 12:38 AM |
|
Posted by ti_nhatrang, 02-06-2010, 12:41 AM |
great! thanks so much!
I have a list of user names, it goes like:
2325434
2354353
3423434
3452366
password will be the same every single time/batch...
please help and thanks for your help once more...
|
Posted by Neseema M M, 02-06-2010, 01:17 AM |
Hi You just need another for loop within that for loop.
Hope it helps.
|
Posted by ti_nhatrang, 02-06-2010, 03:08 AM |
I am pasting these lines in a form, can you please help me make it populate into your script:
my form will have these:
2325434
2354353
3423434
3452366
and an extra form with just the password....
|
Posted by ti_nhatrang, 02-06-2010, 03:15 AM |
I also want to set the start number, and have the end number based on the amount of rows of username Ive pasted....
|
Posted by ti_nhatrang, 02-06-2010, 03:24 AM |
Actually this is what i'm looking for after hitting submit button:
[pictures1]
user=2325434
pass=sdf345tfdf
[pictures2]
user=2354353
pass=sdf345tfdf
[pictures3]
user=3423434
pass=sdf345tfdf
Thanks for all the help I got thus far!
|
Posted by ti_nhatrang, 02-06-2010, 03:28 AM |
Here's what I have thus far and it's not coming out correctly:
in the brackets, it's showing pictures4 for all 4 of them...
|
Posted by Neseema M M, 02-06-2010, 03:29 AM |
Actually what all values do you have in your form?
Can you please paste the code of your form?
|
Posted by ti_nhatrang, 02-06-2010, 03:31 AM |
I don't have it, i'm stil trying to figure that out... but just using your codes for now to see if it works...
|
Posted by ti_nhatrang, 02-06-2010, 03:36 AM |
here's what I got thus far:
|
Posted by Matt R, 02-06-2010, 06:04 AM |
Try putting curly brackets around around $id to see if that helps.
Putting variables too close to other text can sometimes cause the PHP processor to not render things out as variables as expected.
For instance --
echo "[pictures{$id}]\n ";
|
Posted by Chrono, 02-06-2010, 06:53 AM |
echo "[pictures$id]\n "; should be above the 2nd loop
foreach ( range(4,8) as $id ) {
echo "[pictures$id]\n ";
foreach ($users as $user) {
|
Posted by ti_nhatrang, 02-06-2010, 07:04 AM |
This did help, but it still gives me 4 results per pictures id... which I only want pictures 4 to give me A, and pictures5, gives me B.... please help...
|
Posted by Neseema M M, 02-06-2010, 07:17 AM |
Try like this:
Last edited by Neseema M M; 02-06-2010 at 07:20 AM.
Reason: Used brackets
|
Posted by ti_nhatrang, 02-06-2010, 07:20 AM |
fantastic! Can you help me do the form submission to make it go into the $users = array ($formstuff here)?
|
Posted by Neseema M M, 02-06-2010, 07:45 AM |
Try this:
Hope it helps .
|
Posted by ti_nhatrang, 02-06-2010, 07:48 AM |
You are definitely amazing! thank you so much! Thank you to all those that has helped me along the way. I really appreciate your time and effort!
|
Posted by ti_nhatrang, 02-06-2010, 08:14 AM |
Ok, so last step, I want to make a button on top of the result to copy them into clipboard... can somebody please help me achieve this?
|
Add to Favourites Print this Article
Also Read
WHM Theme (Views: 618)