Liam.
> 3Sharp Ltd.
>
> T: 0845 6018370
> F: 0845 6018369
>
> -Original Message-
> From: Karl-Arne Gjersøyen [mailto:karlar...@gmail.com ]
> Sent: 22 July 2013 12:39
> To: PHP Mailinglist
> Subject: Re: [PHP] Foreach and mydql_query problem
>
> 2013/
On 07/22/2013 04:39 AM, Karl-Arne Gjersøyen wrote:
Might I suggest that you place your include for ../../tilkobling.php at
the very top of this page? It would save you from possibly including it
twice.
// The acutual source code is below:
// ==
Your original code snippet had some errors. It really couldn't have
been what you wanted to do.
Example:
You have a named field of 'number_of_items' and then you try to retreive
$_POST['number_of_itemsi']. That won't work.
Then you have a var called $number_of_items which we don't see defi
On 22 Jul 2013, at 13:25, Karl-Arne Gjersøyen wrote:
> 2013/7/22 Stuart Dallas
> On 22 Jul 2013, at 12:56, Karl-Arne Gjersøyen wrote:
>
> > 2013/7/22 Stuart Dallas
> >
> >>
> >> On 22 Jul 2013, at 08:04, Tamara Temple wrote:
> >>
> >>> On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen
> >> w
2013/7/22 Stuart Dallas
> On 22 Jul 2013, at 12:56, Karl-Arne Gjersøyen wrote:
>
> > 2013/7/22 Stuart Dallas
> >
> >>
> >> On 22 Jul 2013, at 08:04, Tamara Temple
> wrote:
> >>
> >>> On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen
> >> wrote:
> >>>
> Hello again.
> I have this this
On 22 Jul 2013, at 12:56, Karl-Arne Gjersøyen wrote:
> 2013/7/22 Stuart Dallas
>
>>
>> On 22 Jul 2013, at 08:04, Tamara Temple wrote:
>>
>>> On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen
>> wrote:
>>>
Hello again.
I have this this source code that not work as I want...
>
2013/7/22 Stuart Dallas
>
> On 22 Jul 2013, at 08:04, Tamara Temple wrote:
>
> > On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen
> wrote:
> >
> >> Hello again.
> >> I have this this source code that not work as I want...
> >>
> >> THe PHP/HTHML form fields is generated by a while loop and look
2013/7/22 Tamara Temple
>
> On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen
> wrote:
>
> > Hello again.
> > I have this this source code that not work as I want...
> >
> > THe PHP/HTHML form fields is generated by a while loop and looks like
> this:
> >
> > " required="required">
> >
> >
> > th
On 22 Jul 2013, at 08:04, Tamara Temple wrote:
> On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen wrote:
>
>> Hello again.
>> I have this this source code that not work as I want...
>>
>> THe PHP/HTHML form fields is generated by a while loop and looks like this:
>>
>> " required="required">
On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen wrote:
> Hello again.
> I have this this source code that not work as I want...
>
> THe PHP/HTHML form fields is generated by a while loop and looks like this:
>
> " required="required">
>
>
> the php source code look like this:
> if(!empty($
Hello again.
I have this this source code that not work as I want...
THe PHP/HTHML form fields is generated by a while loop and looks like this:
" required="required">
the php source code look like this:
";
$sql = "UPDATE item_table SET number_item = '$item' WHERE date
= '$todays_d
On Wed, Oct 17, 2012 at 6:07 PM, Larry Garfield wrote:
> Nothing is wrong with mysqli per se. It's up to date and secure, and
> certainly better than ext/mysql. I recommend PDO over mysqli because:
>
> 1) PHP-engine-level global state (ie, not specifying a connection) is the
> source of most (al
On 10/17/12 10:17 AM, Matijn Woudt wrote:
On Wed, Oct 17, 2012 at 1:25 AM, Larry Garfield wrote:
For the love of god, please stop using ext/mysql (aka the mysql_*
functions). It's insecure and slow and lacks features.
Instead, use PDO, and bind your parameters. As a nice bonus, the result
f
On Wed, Oct 17, 2012 at 1:25 AM, Larry Garfield wrote:
>
> For the love of god, please stop using ext/mysql (aka the mysql_*
> functions). It's insecure and slow and lacks features.
>
> Instead, use PDO, and bind your parameters. As a nice bonus, the result
> from a PDO-based query is not a raw
On Tue, Oct 16, 2012 at 6:25 PM, Larry Garfield wrote:
> Instead, use PDO, and bind your parameters. As a nice bonus, the result
> from a PDO-based query is not a raw resource but an iteratable object, which
> means you can foreach() it.
>
> http://php.net/manual/en/book.pdo.php
>
> $conn = new P
On 10/15/12 9:05 PM, David McGlone wrote:
On Monday, October 15, 2012 08:21:23 PM you wrote:
Bastien Koert
On 2012-10-15, at 8:16 PM, David McGlone wrote:
I've been sitting here playing around with foreach() and I'm wondering why
I am getting these results. here's what I've been fooling aroun
10:46
> Para: 'David McGlone'; 'Bastien'; 'PHP-GENERAL'
> Assunto: RE: [PHP] foreach
>
> > Here's what I ended up with after you gave me the advise:
> > $result = mysql_query("SELECT * FROM items");
> >
> > $rows = array(
On Tuesday, October 16, 2012 09:46:26 AM you wrote:
> > Here's what I ended up with after you gave me the advise:
> > $result = mysql_query("SELECT * FROM items");
> >
> > $rows = array();
> > while($row = mysql_fetch_array($result))
> >
> >$rows[] = $row;
> >
> > foreach($rows as
On 10/15/2012 8:39 PM, Jim Lucas wrote:
On 10/15/2012 05:16 PM, David McGlone wrote:
I've been sitting here playing around with foreach() and I'm wondering
why I
am getting these results. here's what I've been fooling around with.
the code
has no perticular meaning, but I noticed if the script f
On Tue, 2012-10-16 at 10:11 -0400, Steven Staples wrote:
> > -Original Message-
> > From: Matijn Woudt [mailto:tijn...@gmail.com]
> > Steve,
> >
> > Please watch your language on this list.
> >
> > - Matijn
> >
>
> My apologies, I guess using $foo == $bar would have been a better choic
> -Original Message-
> From: Matijn Woudt [mailto:tijn...@gmail.com]
> Steve,
>
> Please watch your language on this list.
>
> - Matijn
>
My apologies, I guess using $foo == $bar would have been a better choice... I
forget sometimes, I am used to chatting with my close friends, where s
On Tue, Oct 16, 2012 at 3:46 PM, Steven Staples wrote:
> One thing I do, is my coding and bracing style is something that Tedd
> Sperling doesn't like (there have been many discussions about bracing
> styles), I keep my braces all in line, and always use them in my if()s...
> ie:
>
> And I do th
s.
Cheers,
Samuel.
-Mensagem original-
De: Steven Staples [mailto:sstap...@mnsi.net]
Enviada em: terça-feira, 16 de outubro de 2012 10:46
Para: 'David McGlone'; 'Bastien'; 'PHP-GENERAL'
Assunto: RE: [PHP] foreach
> Here's what I ended up with after
> Here's what I ended up with after you gave me the advise:
> $result = mysql_query("SELECT * FROM items");
> $rows = array();
> while($row = mysql_fetch_array($result))
>$rows[] = $row;
> foreach($rows as $row){
> $product = $row['product'];
> $price = $row['price'];
> echo "$pro
On Monday, October 15, 2012 08:21:23 PM you wrote:
> Bastien Koert
>
> On 2012-10-15, at 8:16 PM, David McGlone wrote:
> > I've been sitting here playing around with foreach() and I'm wondering why
> > I am getting these results. here's what I've been fooling around with.
> > the code has no pert
On 10/15/2012 05:16 PM, David McGlone wrote:
I've been sitting here playing around with foreach() and I'm wondering why I
am getting these results. here's what I've been fooling around with. the code
has no perticular meaning, but I noticed if the script fails, I get the
sentence "Too expensive I
Bastien Koert
On 2012-10-15, at 8:16 PM, David McGlone wrote:
> I've been sitting here playing around with foreach() and I'm wondering why I
> am getting these results. here's what I've been fooling around with. the code
> has no perticular meaning, but I noticed if the script fails, I get t
I've been sitting here playing around with foreach() and I'm wondering why I
am getting these results. here's what I've been fooling around with. the code
has no perticular meaning, but I noticed if the script fails, I get the
sentence "Too expensive I'm going home LOL" 6 times because there are
-Original Message-
From: Tedd Sperling [mailto:t...@sperling.com]
Sent: Thursday, May 31, 2012 1:01 PM
To: php-general General
Cc: Tristan
Subject: Re: [PHP] [foreach] - is it proper to...
On May 31, 2012, at 12:48 PM, Tristan wrote:
> I'm using Zend Studio and it had a suggest
On May 31, 2012, at 12:48 PM, Tristan wrote:
> I'm using Zend Studio and it had a suggestion that I do a foreach as such
>
> foreach($entry as $entry){
>
> }
>
> instead of
>
> foreach($entries as $entry){
>
> }
>
> they both seem to work but, from a readability standpoint and just makes
> m
Thanks, well that's why I was asking because we just let a guy go for doing
stuff like that among other obvious bad coding issues and terrible logic.
The guy didn't know what he was doing but, I wanted to make sure I wasn't
out of my mind by pointing that out. I am new to Zend Studio so I don't
kno
On Thu, May 31, 2012 at 12:48 PM, Tristan wrote:
> I'm using Zend Studio and it had a suggestion that I do a foreach as such
>
> foreach($entry as $entry){
>
> }
which would be the same as `foreach ($entry)` --- a syntax
option that doesn't exist, but would be ideal.
> foreach($entries
I'm using Zend Studio and it had a suggestion that I do a foreach as such
foreach($entry as $entry){
}
instead of
foreach($entries as $entry){
}
they both seem to work but, from a readability standpoint and just makes
more sense to me to use method 2. Is it bad practice to go with the 1st
met
On Thu, Apr 5, 2012 at 3:15 PM, Ethan Rosenberg wrote:
> I know I am missing something fundamental - but I have no idea where to
> start to look.
It's really difficult to figure out what you're asking. Your code
snippets and associated output seem all jumbled up. It would help
greatly if they wer
Dear Lists -
I know I am missing something fundamental - but I have no idea where
to start to look.
Here are code snippets:
I have truncated the allowed_fields to make it easier to debug.
$allowed_fields = array( 'Site' =>'POST[Site]', 'MedRec' =>
'$_POST[MedRec]', 'Fname' => '$_POST[Fnam
Note that somewhat similar error was discussed on this list a few months
ago[1]. You could probably have solved it yourself if you searched the mailing
list archives.
- Matijn
[1] http://www.mail-archive.com/php-general@lists.php.net/msg269552.html
---
Thanks Matijn, I missed that discussion,
Requesting that will at least require a major-release (f.e. PHP 6.0) ... but I
would rather request to add a notice or warning to the documentation of
references to remind stuff like that.
http://www.php.net/manual/en/language.references.php
I think this is stuff more people will stumble over ...
2012/3/25 Arno Kuhl :
>
> will not only give the wrong result, it will corrupt the array for *any*
> further use of that array. I still think it’s a bug according to the
> definition of foreach in the php manual. Maybe php needs to do an implicit
> unset at the closing brace of the foreach where
On Sun, Mar 25, 2012 at 4:11 PM, Arno Kuhl wrote:
> From: Simon Schick [mailto:simonsimc...@googlemail.com]
> Sent: 24 March 2012 12:30 AM
> To: Robert Cummings
> Cc: a...@dotcontent.net; php-general@lists.php.net
> Subject: Re: [PHP] foreach weirdness
>
> 2012/3/23 Robert
From: Simon Schick [mailto:simonsimc...@googlemail.com]
Sent: 24 March 2012 12:30 AM
To: Robert Cummings
Cc: a...@dotcontent.net; php-general@lists.php.net
Subject: Re: [PHP] foreach weirdness
2012/3/23 Robert Cummings
>
> On 12-03-23 11:16 AM, Arno Kuhl wrote:
>>
>>
&g
> See this following example that illustrates the problem:
> $array = array(0, 1, 2, 3, 4, 5, 6);
> foreach ($array as $index=>$value) {
> if ( ($index+1) < count($array) ) {
> $array[$index+1] += $value;
> }
> echo $value." ";
> }
> echo "";
> foreach ($array as
On 12-03-24 11:15 AM, Al wrote:
On 3/23/2012 10:11 PM, Robert Cummings wrote:
On 12-03-23 06:30 PM, Simon Schick wrote:
2012/3/23 Robert Cummings
On 12-03-23 11:16 AM, Arno Kuhl wrote:
it still does not produce the correct result:
0 1 3 6 10 15 21
0 1 3 6 10 15 15
This looks like a bu
On 3/23/2012 10:11 PM, Robert Cummings wrote:
On 12-03-23 06:30 PM, Simon Schick wrote:
2012/3/23 Robert Cummings
On 12-03-23 11:16 AM, Arno Kuhl wrote:
it still does not produce the correct result:
0 1 3 6 10 15 21
0 1 3 6 10 15 15
This looks like a bug... the last row should be the s
On 12-03-23 06:30 PM, Simon Schick wrote:
2012/3/23 Robert Cummings
On 12-03-23 11:16 AM, Arno Kuhl wrote:
it still does not produce the correct result:
0 1 3 6 10 15 21
0 1 3 6 10 15 15
This looks like a bug... the last row should be the same. What version of
PHP are you using? Have you
2012/3/23 Robert Cummings
>
> On 12-03-23 11:16 AM, Arno Kuhl wrote:
>>
>>
>> it still does not produce the correct result:
>> 0 1 3 6 10 15 21
>> 0 1 3 6 10 15 15
>
>
> This looks like a bug... the last row should be the same. What version of
> PHP are you using? Have you checked the online bug r
On 12-03-23 02:04 PM, Arno Kuhl wrote:
Hi Rob
I'm using php 5.3.5. What result do you get when you run this code?
I haven't checked any bug reports, I'll google to see where I would do that.
Your code gets round the problem, but I was specifically referring to the use
of foreach with its unexp
-Original Message-
From: Robert Cummings [mailto:rob...@interjinn.com]
Sent: 23 March 2012 06:11 PM
To: a...@dotcontent.net
Cc: php-general@lists.php.net
Subject: Re: [PHP] foreach weirdness
On 12-03-23 11:16 AM, Arno Kuhl wrote:
> The following snippet is copied from the php man
On 12-03-23 11:16 AM, Arno Kuhl wrote:
The following snippet is copied from the php manual:
foreach ($arr as $key => $value) {
echo "Key: $key; Value: $value\n";
}
I've always used the foreach loop that way.
But recently I started hitting some really odd problems.
See this following ex
The following snippet is copied from the php manual:
foreach ($arr as $key => $value) {
echo "Key: $key; Value: $value\n";
}
I've always used the foreach loop that way.
But recently I started hitting some really odd problems.
See this following example that illustrates the problem:
$array
.com]
Sent: Tuesday, July 05, 2011 5:47 PM
To: Robert Cummings
Cc: Dajka Tamás; php-general@lists.php.net
Subject: Re: [PHP] Foreach question
Just use count($arr) in your for-header, as it get's executed again
for each loop.
1), array('id'=>2))
On 11-07-05 11:46 AM, Louis Huppenbauer wrote:
Just use count($arr) in your for-header, as it get's executed again
for each loop.
1), array('id'=>2));
for($i=0;$i $arr[$i]['id']+1);
}
}
?>
Ok, so the extents are being updated on each pass of the loop :)
Ch
Just use count($arr) in your for-header, as it get's executed again
for each loop.
1), array('id'=>2));
for($i=0;$i $arr[$i]['id']+1);
}
}
?>
2011/7/5 Robert Cummings :
> On 11-07-05 10:48 AM, Dajka Tamás wrote:
>>
>> Thanks, that was interesting :) I think I got o
On Tue, Jul 5, 2011 at 2:40 PM, Dajka Tamas wrote:
> I've bumped into an interesting thing with foreach. I really don't know, if
> this is normal working, or why it is, so I got curious.
>
> The script:
>
> foreach ( $cats as &$c ) {
> echo $c['id'];
> if ( $c['id'] <
On 11-07-05 10:48 AM, Dajka Tamás wrote:
Thanks, that was interesting :) I think I got one step further in understanding
PHP :)
BTW, I've changed the loop to 'for' and it's working well :)
Can you show us your for loop? I'm not immediately sure how you use a
for loop to traverse a growing nu
On 11-07-05 09:40 AM, Dajka Tamas wrote:
foreach ( $cats as&$c ) {
echo $c['id'];
if ( $c['id']< 5 ) {
$c['id']++;
$cats[] = $c;
}
}
Given that you seem to want the above functi
Dajka Tamás
Cc: php-general@lists.php.net
Subject: Re: [PHP] Foreach question
On 11-07-05 10:39 AM, Dajka Tamás wrote:
> Ok, but if it would be that way I shouldn't get '122334455' for second
> output, no? The item count increments with every iteration of the loop.
>
> Or yo
On 11-07-05 10:39 AM, Dajka Tamás wrote:
Ok, but if it would be that way I shouldn't get '122334455' for second output,
no? The item count increments with every iteration of the loop.
Or you're saying that, it checks for an existance of nextitem before every
loop, and that will fail with just
On 11-07-05 10:39 AM, Dajka Tamás wrote:
Ok, but if it would be that way I shouldn't get '122334455' for second output,
no? The item count increments with every iteration of the loop.
Or you're saying that, it checks for an existance of nextitem before every
loop, and that will fail with jus
l always return true
with two elements? ( since the first elements copy is pushed as third element,
etc )
-Original Message-
From: Robert Cummings [mailto:rob...@interjinn.com]
Sent: Tuesday, July 05, 2011 4:28 PM
To: Dajka Tamás
Cc: php-general@lists.php.net
Subject: Re: [PHP] Foreach q
I don't think that it does this:
if ( count($elements) == 1 ) then loop 1;
else loop normally;
It's probably more something like that:
$i=count($elements);
loop:
$i--;
if($i == 0)
$last_loop = true;
else
$last_loop = false
if($last_loop)
exit;
else
goto loop;
But aside from tha
nt exists for the next
iteration. Consider the following pseudo code:
nextItem = items->reset();
while( nextItem )
{
item = nextItem;
nextItem = items->next();
// Do stuff.
}
There's lots of ways to program a loop... and your PHP foreach loop is
be
= $c;
}
}
But this is 'while' and it pops all elements from the array...
Cheers,
Tamas
-Original Message-
From: Louis Huppenbauer [mailto:louis.huppenba...@gmail.com]
Sent: Tuesday, July 05, 2011 4:12 PM
To: Robert Cummings
Cc: Dajka Tamas; php-general@lists.p
e same with each case )
Cheers,
Tamas
-Original Message-
From: Robert Cummings [mailto:rob...@interjinn.com]
Sent: Tuesday, July 05, 2011 4:06 PM
To: Dajka Tamas
Cc: php-general@lists.php.net
Subject: Re: [PHP] Foreach question
On 11-07-05 09:40 AM, Dajka Tamas wrote:
> Hi a
Or maybe he tried to do the following?
($c['id'] + 1));
}
}
?>
2011/7/5 Robert Cummings :
>
> On 11-07-05 09:40 AM, Dajka Tamas wrote:
>>
>> Hi all,
>>
>>
>>
>> I've bumped into an interesting thing with foreach. I really don't know,
>> if
>> this is normal working, or why it is,
On 11-07-05 09:40 AM, Dajka Tamas wrote:
Hi all,
I've bumped into an interesting thing with foreach. I really don't know, if
this is normal working, or why it is, so I got curious.
The script:
foreach ( $cats as&$c ) {
echo $c['id'];
if ( $c['id']< 5 )
Hi there
I think that foreach in your first example just knowns that this
should be the last loop (as the array only contains 1 element at
start) and so stops there.
In your 2nd example however the first loop isn't the last, so the
array get's checked again, and now there's another element, so...
Hi all,
I've bumped into an interesting thing with foreach. I really don't know, if
this is normal working, or why it is, so I got curious.
The script:
foreach ( $cats as &$c ) {
echo $c['id'];
if ( $c['id'] < 5 ) {
$c['id']
On Wed, Oct 07, 2009 at 03:31:14PM -0700, Haig Davis wrote:
> Hello All,
>
> I have spent the entire day trying to get my calendar app to function
> correctly --- I have no problem with the actual functioning of the
> calendar. What is giving me trouble is for each calendar day the user has
> th
Haig Davis wrote:
> Hello All,
>
> I have spent the entire day trying to get my calendar app to function
> correctly --- I have no problem with the actual functioning of the
> calendar. What is giving me trouble is for each calendar day the user has
> the option to check a checkbox requesting the
Hello All,
I have spent the entire day trying to get my calendar app to function
correctly --- I have no problem with the actual functioning of the
calendar. What is giving me trouble is for each calendar day the user has
the option to check a checkbox requesting the day off and additionally the
On Fri, Jul 31, 2009 at 4:51 PM, Miller,
Terion wrote:
> //Show all restaurants that start with $letter not
> between "A" and "Z"
>
> $other = ctype_digit($letter);
>
> foreach(range('0','9') as $other) {
>
> $sql = "SELECT DISTINCT ID, name, address
> FROMrestaurants
>
-snip---
So I'm almost almost there, but now when I click the # it shows me all records,
is my foreach range not right?
//Create array with letters AND number sign
$letters = range('A','Z');array_push($letters, '#');
On 7/31/09 3:08 PM, "Bastien Koert" wrote:
On Fri, Jul 31, 2009 at 3:10 PM, Miller,
Terion wrote:
>
>
>
> On 7/31/09 2:00 PM, "Miller, Terion" wrote:
>
>
>
>
> On 7/31/09 1:56 PM, "Bastien Koert" wrote:
>
> $letters = '';
>
> Nope still gives the same error: Notice: Undefined index: letter
On Fri, Jul 31, 2009 at 3:10 PM, Miller,
Terion wrote:
>
>
>
> On 7/31/09 2:00 PM, "Miller, Terion" wrote:
>
>
>
>
> On 7/31/09 1:56 PM, "Bastien Koert" wrote:
>
> $letters = '';
>
> Nope still gives the same error: Notice: Undefined index: letter
>
> Well getting closer with this but now my out
On 7/31/09 2:00 PM, "Miller, Terion" wrote:
On 7/31/09 1:56 PM, "Bastien Koert" wrote:
$letters = '';
Nope still gives the same error: Notice: Undefined index: letter
Well getting closer with this but now my output menu is not a clickable link?
On 7/31/09 1:56 PM, "Bastien Koert" wrote:
$letters = '';
Nope still gives the same error: Notice: Undefined index: letter
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Fri, Jul 31, 2009 at 2:51 PM, Miller,
Terion wrote:
>
>
>
> --snip---
>
> --
> Well I almost have it with this, I keep getting an undefined index $letter
> error though and then it outputs the $menu how do I fix that
>
> //Create array with letters AND number sign
> $
--snip---
--
Well I almost have it with this, I keep getting an undefined index $letter
error though and then it outputs the $menu how do I fix that
//Create array with letters AND number sign $letters
= range('A','Z'); array_push($letters,
Miller, Terion wrote:
>
>
> On 7/31/09 12:43 PM, "Bastien Koert" wrote:
>
> On Fri, Jul 31, 2009 at 1:40 PM, Miller,
> Terion wrote:
>>
>>
>> On 7/31/09 12:27 PM, "Bastien Koert" wrote:
>>
>> $letter = isset($_GET['letter']) ? $_GET['letter'] :"";
>>
>> echo '';
>>
>> foreach(range('A','Z')
On 7/31/09 12:43 PM, "Bastien Koert" wrote:
On Fri, Jul 31, 2009 at 1:40 PM, Miller,
Terion wrote:
>
>
>
> On 7/31/09 12:27 PM, "Bastien Koert" wrote:
>
> $letter = isset($_GET['letter']) ? $_GET['letter'] :"";
>
> echo '';
>
> foreach(range('A','Z') as $c){
> ($letter == $c) ? printf('%s
On Fri, Jul 31, 2009 at 1:40 PM, Miller,
Terion wrote:
>
>
>
> On 7/31/09 12:27 PM, "Bastien Koert" wrote:
>
> $letter = isset($_GET['letter']) ? $_GET['letter'] :"";
>
> echo '';
>
> foreach(range('A','Z') as $c){
> ($letter == $c) ? printf('%s ',$c) : printf(' href="browse.php?letter=%s">%s
On 7/31/09 12:27 PM, "Bastien Koert" wrote:
$letter = isset($_GET['letter']) ? $_GET['letter'] :"";
echo '';
foreach(range('A','Z') as $c){
($letter == $c) ? printf('%s ',$c) : printf('%s ',$c,$c);
}
echo '';
//Other
$bNumberShown = false;
foreach(range('0','9') as $n){
if($le
On Fri, Jul 31, 2009 at 12:53 PM, Miller,
Terion wrote:
>
>
>
>
> I have this script that works, just a couple tweeks needed...
>
> 1. I don't want it to default to A being selected
> 2. I need the number range part to only display one # sign not 10 of them,
> somehow I have to have it pull any rec
I have this script that works, just a couple tweeks needed...
1. I don't want it to default to A being selected
2. I need the number range part to only display one # sign not 10 of them,
somehow I have to have it pull any record that does not start with alpha
';
fo
That would be correct. but two things I have to add:
* it's called bad style to re-write (override) predefined vars like
_POST, _GET, _SERVER ...
* using strip_tags() to clean user-input for safe output ist not O.K.!
use htmlspecialchars(), at least.
Regards,
2009/3/28 Virgilio Quilario :
>> Hi
Try this...
$_POST = array_map('stri_tags', $_POST);
Igor Escobar
systems analyst & interface designer
www . igorescobar . com
On Sat, Mar 28, 2009 at 6:21 PM, Angus Mann wrote:
> Thanks Ashley...that did the trick.
> After reading about the limitations of strip_tags I decided to just repla
Thanks Ashley...that did the trick.
After reading about the limitations of strip_tags I decided to just replace
the bad bits as below...
It still uses your "foreach" suggestion but replaces "<" and ">" with "("
and ")" instead of stripping tags.
I think I will extend the good and bad arrays to
> Hi all.
>
> I'm writing a script that accepts several different forms with different
> content. Depending on what data is sent with the form the script will do one
> or the other think.
>
> Before the form data is processed I'd like to scrub it of HTML tags.
>
> I can do this manually as below
On Sat, 2009-03-28 at 18:28 +1000, Angus Mann wrote:
> Hi all.
>
> I'm writing a script that accepts several different forms with different
> content. Depending on what data is sent with the form the script will do one
> or the other think.
>
> Before the form data is processed I'd like to scru
Hi all.
I'm writing a script that accepts several different forms with different
content. Depending on what data is sent with the form the script will do one or
the other think.
Before the form data is processed I'd like to scrub it of HTML tags.
I can do this manually as below but the form ma
PHP does have garbage_collection, and it's crucial in long-running CLI scripts.
Per is right, though, in that if your web-page Apache PHP script needs GC, you
are doing something terribly wrong.
It is not as aggressive/thorough as, say, the Lisp GC, but it's there.
ymmv
--
PHP Genera
Tim | iHostNZ wrote:
> Somewhere i also read that one can save a lot of memory by destroying
> variables. Is that done with unset, setting it to null or something
> similar?
unset()
> So, i take there is no garbage collection in php? I've never
> actually looked at the c source code of php. Ma
Hi All,
Just to annoy the hell out of you, another thing that has been on my mind
for a while:
I love the foreach ($ar as $k => $v) { ... } construct and use it all the
time. However, I read somewhere that foreach actually uses a copy of $ar
instead of the array itself by reference. Wouldn't it b
On Jul 29, 2008, at 3:33 PM, Daniel Brown wrote:
On Tue, Jul 29, 2008 at 3:25 PM, Jason Pruim <[EMAIL PROTECTED]>
wrote:
function random($random){
$randomQuery = "SELECT * FROM `current` ORDER BY Rand() LIMIT
2";
$result = mysql_query($randomQuery);
$row[] = $result;
forea
You cannot do this:
$row[] = $result;
You need to loop around this:
$row = mysql_fetch_assoc($result);
Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com
Jason Pruim wrote:
> Hey Everyone...
>
> So I am attempting to pull 2 random records from a MySQL databa
On Tue, Jul 29, 2008 at 3:25 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:
>
> function random($random){
>
>$randomQuery = "SELECT * FROM `current` ORDER BY Rand() LIMIT 2";
>
>$result = mysql_query($randomQuery);
> $row[] = $result;
>
>
> foreach($row as $key => $value) {
> $random[$k
Hey Everyone...
So I am attempting to pull 2 random records from a MySQL database, so
I wrote a function which I'll paste below. I had it mostly working
with a while() statement, but I wanted to try a foreach to see if I
could get the formatting a little bit better.
Basically... What it d
jamest wrote:
I am passing an array to a class which I want to take the array data and
create some variables from the array's keys and values.
So I want to create (in this case 21) new variables that I want to create in
the foreach but with no success.
foreach ($formdata as $key => $value) {
Thats perfect. I didn't even know about this.
Stut wrote:
>
>
> $$key = $value;
>
> They're called variable variables - search the manual for that term
> for more info.
>
> -Stut
>
> --
> http://stut.net/
>
>
--
View this message in context:
http://www.nabble.com/foreach-loop-to-set
On Apr 25, 2008, at 6:12 AM, jamest <[EMAIL PROTECTED]> wrote:
I am passing an array to a class which I want to take the array data
and
create some variables from the array's keys and values.
So I want to create (in this case 21) new variables that I want to
create in
the foreach but wit
1 - 100 of 302 matches
Mail list logo