Thanks to everyone,
What i did was:
<?php
$i = 0;
foreach ($results as $error) :
foreach ($results as $error) :
$i = $i++;
?>
<li><?php echo $error ;?></li>
<?php endforeach; ?>
?>
<li><?php echo $error ;?></li>
<?php endforeach; ?>
Its just for tracking a user actions on my site....so if they do something they should not be doing such as messing with the URL or links/forms with Firebug it saves the 'bad' info they tried changing it to , where they tied changing it to in a db, and I get a report of who was doing stuff they should not be doing. So thats why the number can change..if they added 5 text fields in a form using Firebug or something i see the 5 fields they added and what they tried to submit.
From: Aivaras [mailto:faifas1337@gmail.com]
Sent: April-30-09 5:06 AM
To: cake-php@googlegroups.com
Subject: Re: Value from Key
echo $array[$i]; // will output your error
echo $i; // will output the index.
}
Still, I have absolutely no idea why would you need to know indexes for error reporting.
Faifas
On Thu, Apr 30, 2009 at 02:30, Dave Maharaj :: WidePixels.com <dave@widepixels.com> wrote:
Right but the [0] [1] will change depending on the array its self.I do not know the number that will be generated as it could be an array of errors.If there is 1 error [0] but if 10 errors?Ideas?
From: Aivaras [mailto:faifas1337@gmail.com]
Sent: April-29-09 7:42 PM
To: cake-php@googlegroups.com
Subject: Re: Value from KeyHey,
echo $the_variable_you_are_pr_ing[$key]
example: echo $aNonsenceLetters[0]; // outputs: jkl
Cheers,
Faifas
On Thu, Apr 30, 2009 at 00:47, Dave Maharaj :: WidePixels.com <dave@widepixels.com> wrote:
How can i get the value of a key?
the array is from debug($requests);
for example my array is:
Array
(
[0] => jkl
[1] => ii
[2] => yyy
)
thanks,
Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment