RES: [PHP] Array help.

2012-10-24 Thread Samuel Lopes Grigolato
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

Re: [PHP] Array help.

2012-10-24 Thread Paul Halliday
] 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

RE: [PHP] Array help.

2012-10-24 Thread Ford, Mike
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

[PHP] Array help.

2010-07-30 Thread Paul Halliday
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

Re: [PHP] Array help.

2010-07-30 Thread Joshua Kehn
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 =

Re: [PHP] Array help.

2010-07-30 Thread Paul Halliday
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

Re: [PHP] Array help.

2010-07-30 Thread Joshua Kehn
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;

[PHP] Array help

2007-03-04 Thread Ryan A
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');

Re: [PHP] Array help

2007-03-04 Thread Stut
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');

Re: [PHP] Array help

2007-03-04 Thread Ryan A
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

Re: [PHP] Array help

2007-03-04 Thread Stut
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

Re: [PHP] Array help

2007-03-04 Thread Tijnema !
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)

Re: [PHP] Array help

2007-03-04 Thread Ryan A
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

[PHP] array help

2005-07-14 Thread Fletcher Mattox
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: []

Re: [PHP] array help

2005-07-14 Thread Robert Cummings
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

Re: [PHP] array help

2005-07-14 Thread Richard Davey
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)

Re: [PHP] array help

2005-07-14 Thread Fletcher Mattox
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

Re: [PHP] Array Help

2005-03-15 Thread Richard Lynch
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

[PHP] Array Help

2005-03-14 Thread Phil Neeb
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.

Re: [PHP] Array Help

2005-03-14 Thread Robert Cummings
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

[PHP] Array help

2004-11-02 Thread Ryan A
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(

RE: [PHP] Array help

2004-11-02 Thread Jay Blanchard
[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

[PHP] Array help

2004-07-23 Thread Robb Kerr
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

Re: [PHP] Array help

2004-07-23 Thread Matt M.
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.)

Re: [PHP] Array help

2004-07-23 Thread Jason Davidson
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

Re: [PHP] Array help

2004-07-23 Thread Matthew Sims
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,

Re: [PHP] Array help

2004-07-23 Thread Robb Kerr
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'];

RE: [PHP] Array help

2004-07-23 Thread Pablo Gosse
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

Re: [PHP] Array help

2004-07-23 Thread Matt M.
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 =

Re: [PHP] Array help

2004-07-23 Thread Matthew Sims
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 =

Re: [PHP] Array help

2003-07-28 Thread skate
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

[PHP] Array help

2003-07-27 Thread Ryan A
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 );

Re: [PHP] Array help

2003-07-27 Thread Jason Wong
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

[PHP] array help please

2003-01-05 Thread John Fishworld
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 !

Re: [PHP] array help please

2003-01-05 Thread David T-G
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

RE: [PHP] array help please

2003-01-05 Thread David Freeman
$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

[PHP] Array Help

2001-11-27 Thread Brian V Bonini
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]

RE: [PHP] Array Help

2001-11-27 Thread Jack Dempsey
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

[PHP] Array HELP PLEASE

2001-11-08 Thread René Fournier
(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

RE: [PHP] Array HELP PLEASE

2001-11-08 Thread René Fournier
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

Re: [PHP] Array HELP PLEASE

2001-11-08 Thread Jim Lucas
] 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

RE: [PHP] Array HELP PLEASE

2001-11-08 Thread René Fournier
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

RE: [PHP] Array HELP PLEASE

2001-11-08 Thread Martin Towell
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

[PHP] Array help please

2001-05-04 Thread peter.beal
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

Re: [PHP] Array help please

2001-05-04 Thread Jason Stechschulte
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

Re: [PHP] Array help please

2001-05-04 Thread peter.beal
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

[PHP] Array help

2001-03-14 Thread Chris
Hi, Is there a way to do an array_pop with php3?

Re: [PHP] Array help

2001-03-14 Thread David Robley
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

RE: [PHP] Array help

2001-03-14 Thread James Atkinson
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;

RE: [PHP] Array help

2001-03-14 Thread Don Read
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.

[PHP] Array Help

2001-02-23 Thread Brian V Bonini
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" =

Re: [PHP] Array Help

2001-02-23 Thread php3
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" =

Re: SV: [PHP] Array help needed

2001-01-18 Thread CDitty
"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

Re: [PHP] Array help needed

2001-01-18 Thread php3
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

Re: [PHP] Array help needed

2001-01-18 Thread April
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

Re: [PHP] Array help needed

2001-01-18 Thread CDitty
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