Could you try changing this:
if($groupTest != FALSE) {
to this:
if($groupTest !== FALSE) {
?
-Mensagem original-
De: Paul Halliday [mailto:paul.halli...@gmail.com]
Enviada em: quarta-feira, 24 de outubro de 2012 15:38
Para: PHP-General
Assunto: [PHP] Array help.
I am processing
]
Enviada em: quarta-feira, 24 de outubro de 2012 15:38
Para: PHP-General
Assunto: [PHP] Array help.
I am processing v4IP's and what I want to do is a prefix substitution if the
3rd octet matches a predefined list $groupMappings. I went down this path
and it isn't working as expected. Drawing
From: Paul Halliday [paul.halli...@gmail.com]
Sent: 24 October 2012 18:38
To: PHP-General
Subject: [PHP] Array help.
$groupMappings = array('40' ='A','41' ='B','1' ='C');
$ocTest = explode(., $ip);
$groupKeys = array_keys($groupMappings);
$groupTest = array_search
I have a query that may not always return a result for a value, I need
to reflect this with a 0. I am trying to overcome this by doing this
(the keys are ID's):
while ($row = mysql_fetch_row($statusQuery)) {
$cat = array(0=0,1=0,11=0,12=0,13=0,14=0,15=0,16=0,17=0,19=0);
switch
On Jul 30, 2010, at 2:36 PM, Paul Halliday wrote:
I have a query that may not always return a result for a value, I need
to reflect this with a 0. I am trying to overcome this by doing this
(the keys are ID's):
while ($row = mysql_fetch_row($statusQuery)) {
$cat =
On Fri, Jul 30, 2010 at 3:44 PM, Joshua Kehn josh.k...@gmail.com wrote:
On Jul 30, 2010, at 2:36 PM, Paul Halliday wrote:
I have a query that may not always return a result for a value, I need
to reflect this with a 0. I am trying to overcome this by doing this
(the keys are ID's):
while
On Jul 30, 2010, at 3:03 PM, Paul Halliday wrote:
Paul-
Why are those values not defaulted to 0 in the database?
Regards,
-Josh
They are defaulted, the query is grouping:
select count(status) as count, status from table group by status order
by status desc;
Hi!
I have a login/password file with these kind of values:
user1:pass1
user2:pass2
cat:dog
love:hate
I have opened the file and put it into an array with this code:
(thanks to richard lynch from this list for idea and code snippets)
$file = file_get_contents('a.htpasswd');
Ryan A wrote:
I have a login/password file with these kind of values:
user1:pass1
user2:pass2
cat:dog
love:hate
I have opened the file and put it into an array with this code:
(thanks to richard lynch from this list for idea and code snippets)
$file = file_get_contents('a.htpasswd');
Hey Stut,
Thanks for replying.
Will be making two versions, one with a DB and one to work with the file for
the old school folks who dont want to convert their file and use new fangled
databases... some people its easier to just not argue or try to convince...
and however stupid someone's
Ryan A wrote:
Will be making two versions, one with a DB and one to work with the file
for the old school folks who dont want to convert their file and use
new fangled databases... some people its easier to just not argue or
try to convince...
and however stupid someone's opinion is, they are
Well, you are using the file_get_contents function right now, what about a
loop that reads the file line by line, checks if the user matches, and stops
when found the right user?
it's an all in one loop :)
just like this:
$found = false;
$fp = fopen($file,r);
while(!feof($fp) $found == false)
Hey!
Thanks Stut, Tijnema.
I'll test out the ideas you guys contributed to me.. after I finish a working
copy will ask you guys to give it a look over ;)
@Stut: The list is not in alphabetical order.. and 2, I have no idea of the
size of the file (for the regex suggestion) but I am guessing
How does one represent a MySQL table as a two dimensional array
using the column names as one of the indices? My naive attempt
went something like this:
while ($row = mysqli_fetch_assoc($result))
$table[] = $row;
but that generated this error;
Fatal error: []
Did you bother to initialize $table as an array() or are you another
lazy slob of a programmer that expects the engine to read your mind
(cluttered as that may be)?
Cheers,
Rob.
On Thu, 2005-07-14 at 18:33, Fletcher Mattox wrote:
How does one represent a MySQL table as a two dimensional array
Hello Fletcher,
Thursday, July 14, 2005, 11:33:36 PM, you wrote:
FM while ($row = mysqli_fetch_assoc($result))
FM $table[] = $row;
FM but that generated this error;
FM Fatal error: [] operator not supported for strings
The above WILL work providing that (1)
Rob writes:
Did you bother to initialize $table as an array() or are you another
lazy slob of a programmer that expects the engine to read your mind
(cluttered as that may be)?
Bingo.
You seem to have no trouble reading my mind, why can't php? :)
Years of perl programming has promoted a
I'm running into the problem of not having a server that gives me database
access or ability to use files to store my data ... Yeah, I know, it
sucks.
If switching servers isn't an option, just pay for another one somewhere,
and then re-direct or something.
The time you save HAS to be worth
Greets,
I'm running into the problem of not having a server that gives me database
access or ability to use files to store my data ... Yeah, I know, it sucks.
Anyway ... My page has a number of profiles about people involved with my
organization and all the profiles load into a set appearance.
On Mon, 2005-03-14 at 18:07, Phil Neeb wrote:
Greets,
I'm running into the problem of not having a server that gives me database
access or ability to use files to store my data ... Yeah, I know, it sucks.
Anyway ... My page has a number of profiles about people involved with my
Hi,
I have an variable that contains an array like this:
[0] = Array(
[0] = Array([0] = {3 3})
[1] = Array([0] = 3)
)
[1] = Array(
[0] = Array([0] = {3 3})
[1] = Array([0] = 3)
)
[2] = Array(
[0] = Array(
[snip]
[2] = Array(
[0] = Array(
[0] = {textlinks 0_15}
[1] = {textlinks 16_30}
)
[1] = Array(
[0] = 0_15
[1] = 16_30
)
)
As you can see
I've got a field in my database that contains a single numerical character
(1 or 2 or 3, etc.). I need to load a different background image in
one cell of a table depending upon what the number the field contains.
What's the easy syntax for associating entries in the field (1 or 2 or
3, etc.) with
I've got a field in my database that contains a single numerical character
(1 or 2 or 3, etc.). I need to load a different background image in
one cell of a table depending upon what the number the field contains.
What's the easy syntax for associating entries in the field (1 or 2 or
3, etc.)
You can either hard code the associations, with something like a
swtich statement, or i suppose loop thru one array, adding a key value
pair of the numbers = background images. Or, you could create a
table called Backgrounds, give them an id which you store in the
existing field of your db, and
I've got a field in my database that contains a single numerical character
(1 or 2 or 3, etc.). I need to load a different background image in
one cell of a table depending upon what the number the field contains.
What's the easy syntax for associating entries in the field (1 or 2 or
3,
On Fri, 23 Jul 2004 14:21:42 -0700 (PDT), Matthew Sims wrote:
imgBkgrnd = array(1= bkgrnd-default.gif, 2 =
bkgrnd-positive.gif, 3 = bkgrnd-negative.gif);
You got it...
imgBkgrnd = array(1= bkgrnd-default.gif, 2 = bkgrnd-positive.gif,
3 = bkgrnd-negative.gif);
imgNeeded = table['field'];
Robb Kerr wrote:
On Fri, 23 Jul 2004 14:21:42 -0700 (PDT), Matthew Sims wrote:
imgBkgrnd = array(1= bkgrnd-default.gif, 2 =
bkgrnd-positive.gif, 3 = bkgrnd-negative.gif);
You got it...
imgBkgrnd = array(1= bkgrnd-default.gif, 2 =
bkgrnd-positive.gif, 3 = bkgrnd-negative.gif); imgNeeded
imgBkgrnd = array(1= bkgrnd-default.gif, 2 =
bkgrnd-positive.gif, 3 = bkgrnd-negative.gif);
You got it...
imgBkgrnd = array(1= bkgrnd-default.gif, 2 = bkgrnd-positive.gif,
3 = bkgrnd-negative.gif);
imgNeeded = table['field'];
imgName = ???
http://us3.php.net/array
$imgBkgrnd =
imgBkgrnd = array(1= bkgrnd-default.gif, 2 =
bkgrnd-positive.gif, 3 = bkgrnd-negative.gif);
You got it...
imgBkgrnd = array(1= bkgrnd-default.gif, 2 =
bkgrnd-positive.gif,
3 = bkgrnd-negative.gif);
imgNeeded = table['field'];
imgName = ???
http://us3.php.net/array
$imgBkgrnd =
because in reality I don't have just these 4 fields
but 43 fields in one table that have to be taken. Select *... seems a
much
easier way to get it
you have 43 fields in 1 table? if you are seriously considering offering
hosting packages, then i'm guessing your wanting to be half
Hi,
After asking for help on the list Skate gave me the following code as an
example:
**
$n = 0;
$result = mysql_query( SELECT id, title, text, date FROM news ORDER BY date
DESC );
while ($rows = mysql_fetch_array($result)) {
if( $rows == ){ continue; }
extract( $rows );
On Monday 28 July 2003 10:19, Ryan A wrote:
After asking for help on the list Skate gave me the following code as an
example:
**
$n = 0;
$result = mysql_query( SELECT id, title, text, date FROM news ORDER BY
date DESC );
while ($rows = mysql_fetch_array($result)) {
if( $rows
can someone give me a bit of help / walthrough the following for me !
this first bits is okay
$mysql query1
result
array[cityid][cityname]
mysql query2
result
array[cityid][cityname]
now what i want to do is kick out any doubles in my array and resort them
alphebetically by cityname ?!
help !
John, et al --
...and then John Fishworld said...
%
% can someone give me a bit of help / walthrough the following for me !
Let's see if I can help.
% this first bits is okay
% $mysql query1
% result
% array[cityid][cityname]
%
% mysql query2
% result
% array[cityid][cityname]
Are CityIDs
$mysql query1
result
array[cityid][cityname]
mysql query2
result
array[cityid][cityname]
now what i want to do is kick out any doubles in my array
and resort them alphebetically by cityname ?!
It's difficult to answer this question without knowing more about the
context and
How can I access the inner most info in this array?
Ie, Item and url
$var = array(
category = array(
subcategory = array(
Item = url
),
)
);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
you can just kept adding []'s
$var[category][subcategory][Item] = url;
-Original Message-
From: Brian V Bonini [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 27, 2001 4:56 PM
To: PHP Lists
Subject: [PHP] Array Help
How can I access the inner most info in this array?
Ie, Item
(Before you write RTFM, please know that I have checked www.php.net,
zend.com, phpbuilder.com, et all, and--in the eternal words of Bono--I still
haven't found what I'm looking.)
The situation: I extract an array from a MySQL table. Code:
$models = mysql_fetch_array(mysql_query(SELECT
Oops, guess I posted too soon. Just figured out the problem myself (use a
do/while...). Thanks anyways.
-Original Message-
From: René Fournier [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 08, 2001 3:25 PM
To: Php-General
Subject: [PHP] Array HELP PLEASE
(Before you write
] Array HELP PLEASE
(Before you write RTFM, please know that I have checked www.php.net,
zend.com, phpbuilder.com, et all, and--in the eternal words of Bono--I
still
haven't found what I'm looking.)
The situation: I extract an array from a MySQL table. Code:
$models = mysql_fetch_array
Message-
From: René Fournier [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 08, 2001 3:39 PM
To: Php-General
Subject: RE: [PHP] Array HELP PLEASE
Oops, guess I posted too soon. Just figured out the problem myself (use a
do/while...). Thanks anyways.
-Original Message-
From
PROTECTED]]
Sent: Friday, November 09, 2001 10:06 AM
To: Php-General
Subject: RE: [PHP] Array HELP PLEASE
Or maybe not. :-) Although I got both rows displaying, they're actually two
long to fit comfortably (w/o horizontally scrolling). So... I'd like to
flip the axis of the table, so my header
I'm trying to debug some software that I downloaded from the web.
It seems to work fine most of the time however it occasionally crashed with
database errors.
When I look at the code it has a lot of array references that i don't
understand
e.g. $Session[clientID]
most references at are of
On Fri, May 04, 2001 at 01:19:57PM +0100, peter.beal wrote:
I'm trying to debug some software that I downloaded from the web.
It seems to work fine most of the time however it occasionally crashed with
database errors.
When I look at the code it has a lot of array references that i don't
Thanks
Peter
Jason Stechschulte [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Fri, May 04, 2001 at 01:19:57PM +0100, peter.beal wrote:
I'm trying to debug some software that I downloaded from the web.
It seems to work fine most of the time however it
Hi,
Is there a way to do an array_pop with php3?
On Thu, 15 Mar 2001 10:56, Chris wrote:
Hi,
Is there a way to do an array_pop with php3?
Off the top of my head:
use count to get the number of elements in the array
grab element(count - 1) as the popped value
Then (maybe)
unset(element[count-1])
may work; if not you might have to play
Hi,
Is there a way to do an array_pop with php3?
Here's some PHP 3 compatable code that works the same as array_pop:
function _array_pop($stack) {
$arrSize = count($stack);
$x = 1;
while(list($key, $val) = each($stack)) {
if($x count($stack)) {
$tmpArr[] = $val;
On 15-Mar-01 Chris wrote:
Hi,
Is there a way to do an array_pop with php3?
unset($dirs[sizeof($dirs)-1]); // php4 array_pop();
Regards,
--
Don Read [EMAIL PROTECTED]
-- If you are going to sin, sin against God, not the bureaucracy.
I've tried and tried and tried ;-)
I have this array;
$bikes = array(
"Road" = array(
"Trek" = array(
"Trek 5200" = "road.php?brand=t5200"
),
"Schwinn" = array(
"Schwinn Fastback Pro" =
Addressed to: [EMAIL PROTECTED]
[EMAIL PROTECTED]
** Reply to note from [EMAIL PROTECTED] Fri, 23 Feb 2001 12:20:12 -0500
I've tried and tried and tried ;-)
I have this array;
$bikes = array(
"Road" = array(
"Trek" = array(
"Trek 5200" =
"Number: " . $s. " count: " . $count[$s] . "Br";
}
-Opprinnelig melding-
Fra: CDitty [mailto:[EMAIL PROTECTED]]
Sendt: 18. januar 2001 12:40
Til: [EMAIL PROTECTED]
Emne: [PHP] Array help needed
Hello all,
I have 6 numbers that are in an arr
Addressed to: CDitty [EMAIL PROTECTED]
[EMAIL PROTECTED]
** Reply to note from CDitty [EMAIL PROTECTED] Thu, 18 Jan 2001 06:58:22 -0600
I see someone else has another suggestion that might be better, using
array_count(). You learn something new every day, which is why I watch
January 18, 2001 10:40 AM
Subject: Re: [PHP] Array help needed
I wouldn't call it a php standard.
I personally feel that readability is far more important than following
anything that 'appears' to be standard. I use a format such as this for
everything I name: If one word, lowercase, if mor
Thanks. Didn't see that myself.
Thanks for the help
Chris
At 10:28 AM 1/18/01, [EMAIL PROTECTED] wrote:
Addressed to: CDitty [EMAIL PROTECTED]
[EMAIL PROTECTED]
** Reply to note from CDitty [EMAIL PROTECTED] Thu, 18 Jan 2001
06:58:22 -0600
I see someone else has another
56 matches
Mail list logo