Re: [PHP] array question

2010-12-20 Thread Ravi Gehlot
Jim Lucas has it. You can use the preg_match function to find it. I would use regexp for that reason. regexp is good for making sure things are typed the way they need to (mostly used for). Ravi. On Sat, Dec 18, 2010 at 5:17 PM, Jim Lucas wrote: > On 12/17/2010 12:52 PM, Sorin Buturugeanu wrot

Re: [PHP] array question

2010-12-18 Thread Jim Lucas
On 12/17/2010 12:52 PM, Sorin Buturugeanu wrote: Hello all! I have a question regarding arrays and the way I can use a value. Let's say I have this string: $s = 'banana,apple,mellon,grape,nut,orange' I want to explode it, and get the third value. For this I would normally do: $a = explode(',

Re: [PHP] array question

2010-12-17 Thread Sorin Buturugeanu
Tanks for all of your responses! I guess a function is the way to go. I just have to see if the situation comes up enough times to justify the function approach. @Dan: I really enjoyed your disclaimer :D -- Sorin Buturugeanu www.soin.ro

Re: [PHP] array question

2010-12-17 Thread Daniel Brown
On Fri, Dec 17, 2010 at 15:52, Sorin Buturugeanu wrote: > Hello all! > > I have a question regarding arrays and the way I can use a value. > > Let's say I have this string: > > $s = 'banana,apple,mellon,grape,nut,orange' > > I want to explode it, and get the third value. For this I would normally

RE: [PHP] array question

2010-12-17 Thread Jay Blanchard
[snip] I have a question regarding arrays and the way I can use a value. Let's say I have this string: $s = 'banana,apple,mellon,grape,nut,orange' I want to explode it, and get the third value. For this I would normally do: $a = explode(',', $s); echo $s[2]; That's all fine, but is there a way

[PHP] array question

2010-12-17 Thread Sorin Buturugeanu
Hello all! I have a question regarding arrays and the way I can use a value. Let's say I have this string: $s = 'banana,apple,mellon,grape,nut,orange' I want to explode it, and get the third value. For this I would normally do: $a = explode(',', $s); echo $s[2]; That's all fine, but is there

Re: [PHP] Array question

2010-09-26 Thread tedd
At 3:31 PM -0500 9/25/10, MikeB wrote: -snip- My question, in the loop, why does tha author use: $results[] = mysql_fetch_array($result); instead of (as I would expect): $results[$j] = mysql_fetch_array($result);? What PHP magic is at work here? Mike: That's just a shorthand way to popula

Re: [PHP] Array question

2010-09-26 Thread a...@ashleysheridan.co.uk
eater than the highest already in use. As the index 2 was explicitly created, php made the next one at 3. Thanks, Ash http://www.ashleysheridan.co.uk - Reply message - From: "chris h" Date: Sat, Sep 25, 2010 22:05 Subject: [PHP] Array question To: "MikeB" Cc: Mike,

Re: [PHP] Array question

2010-09-25 Thread chris h
Mike, $results[] will automatically push a value unto the end of an array. So doing this... -- $magic = array(); $magic[] = 'a'; $magic[] = 'b'; $magic[] = 'c'; - is exactly this same as doing this... -- $normal = array(); $normal[0] = 'a'; $normal[1] = 'b'; $normal[2] = 'c'; -

[PHP] Array question

2010-09-25 Thread MikeB
I have the following code: $query = "SELECT * FROM classics"; $result = mysql_query($query); if (!$result) die ("Database access failed: " . mysql_error()); $rows = mysql_num_rows($result); for ($j = 0 ; $j < $rows ; ++$j) { $results[] = mysql_fetch_array($result); } mysql_close($db_server

Re: [PHP] Array Question

2007-07-17 Thread kvigor
Thanks for all the input. You've all been pretty informative. Sorry of delayed response to help but was busy. You all are appreciated. "Stut" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Richard Lynch wrote: >> On Wed, July 11, 2007 4:16 pm, Robert Cummings wrote: But I

Re: [PHP] Array Question

2007-07-14 Thread Robert Cummings
On Sat, 2007-07-14 at 00:55 -0500, Richard Lynch wrote: > On Fri, July 13, 2007 2:15 am, Richard Lynch wrote: > > On Thu, July 12, 2007 8:29 am, Robert Cummings wrote: > >> Hmmm, I thought using an explicit cast was very self explanatory -- > >> especially when the name of the cast is "array". Mayb

Re: [PHP] Array Question

2007-07-13 Thread Richard Lynch
On Fri, July 13, 2007 2:15 am, Richard Lynch wrote: > On Thu, July 12, 2007 8:29 am, Robert Cummings wrote: >> Hmmm, I thought using an explicit cast was very self explanatory -- >> especially when the name of the cast is "array". Maybe I'm alone in >> that >> thought. I mean if you convert a scala

Re: [PHP] Array Question

2007-07-13 Thread Robert Cummings
On Fri, 2007-07-13 at 02:15 -0500, Richard Lynch wrote: > On Thu, July 12, 2007 8:29 am, Robert Cummings wrote: > > Hmmm, I thought using an explicit cast was very self explanatory -- > > especially when the name of the cast is "array". Maybe I'm alone in > > that > > thought. I mean if you convert

Re: [PHP] Array Question

2007-07-13 Thread Richard Lynch
On Thu, July 12, 2007 8:29 am, Robert Cummings wrote: > Hmmm, I thought using an explicit cast was very self explanatory -- > especially when the name of the cast is "array". Maybe I'm alone in > that > thought. I mean if you convert a scalar to an array what do you expect > to get? An array with t

Re: [PHP] Array Question

2007-07-12 Thread Robert Cummings
On Thu, 2007-07-12 at 09:58 +0100, Stut wrote: > Richard Lynch wrote: > > On Wed, July 11, 2007 4:16 pm, Robert Cummings wrote: > >>> But I'd have to say that the intent is not all that clear, really, > >>> and > >>> I'd be leery of this feature, personally. > >> I wouldn't be leery at all. It's be

Re: [PHP] Array Question

2007-07-12 Thread Stut
Richard Lynch wrote: On Wed, July 11, 2007 4:16 pm, Robert Cummings wrote: But I'd have to say that the intent is not all that clear, really, and I'd be leery of this feature, personally. I wouldn't be leery at all. It's been around for a very long time and it's documented: http://www.php.net

Re: [PHP] Array Question

2007-07-11 Thread Robert Cummings
On Wed, 2007-07-11 at 16:40 -0500, Richard Lynch wrote: > On Wed, July 11, 2007 4:16 pm, Robert Cummings wrote: > >> But I'd have to say that the intent is not all that clear, really, > >> and > >> I'd be leery of this feature, personally. > > > > I wouldn't be leery at all. It's been around for a

Re: [PHP] Array Question

2007-07-11 Thread Richard Lynch
On Wed, July 11, 2007 4:16 pm, Robert Cummings wrote: >> But I'd have to say that the intent is not all that clear, really, >> and >> I'd be leery of this feature, personally. > > I wouldn't be leery at all. It's been around for a very long time and > it's documented: > > > http://www.php.net/manua

Re: [PHP] Array Question

2007-07-11 Thread Robert Cummings
On Wed, 2007-07-11 at 16:11 -0500, Richard Lynch wrote: > On Wed, July 11, 2007 9:52 am, Stut wrote: > >> $needle = (array)$needle; > >> > >> Conversion to array creates an array with one element... the value > >> converted. > > > > Without raising a notice? > > Sure looks like it: > php -d er

Re: [PHP] Array Question

2007-07-11 Thread Richard Lynch
On Wed, July 11, 2007 9:52 am, Stut wrote: >> $needle = (array)$needle; >> >> Conversion to array creates an array with one element... the value >> converted. > > Without raising a notice? Sure looks like it: php -d error_reporting=2047 -r '$foo = (array) "foo"; var_dump($foo);' array(1) { [

Re: [PHP] Array Question

2007-07-11 Thread Robin Vickery
On 11/07/07, Robert Cummings <[EMAIL PROTECTED]> wrote: On Wed, 2007-07-11 at 09:46 +0100, Robin Vickery wrote: > On 11/07/07, kvigor <[EMAIL PROTECTED]> wrote: > > Is there a php function similar to in_array that can detect if a "partial > > value" is in an array value or not: > > > > e.g. > > >

Re: [PHP] Array Question

2007-07-11 Thread Robert Cummings
On Wed, 2007-07-11 at 16:07 +0100, Stut wrote: > Robert Cummings wrote: > > On Wed, 2007-07-11 at 15:52 +0100, Stut wrote: > >> Robert Cummings wrote: > >>> On Wed, 2007-07-11 at 09:46 +0100, Robin Vickery wrote: > On 11/07/07, kvigor <[EMAIL PROTECTED]> wrote: > > Is there a php function

Re: [PHP] Array Question

2007-07-11 Thread Stut
Robert Cummings wrote: On Wed, 2007-07-11 at 15:52 +0100, Stut wrote: Robert Cummings wrote: On Wed, 2007-07-11 at 09:46 +0100, Robin Vickery wrote: On 11/07/07, kvigor <[EMAIL PROTECTED]> wrote: Is there a php function similar to in_array that can detect if a "partial value" is in an array v

Re: [PHP] Array Question

2007-07-11 Thread Robert Cummings
On Wed, 2007-07-11 at 15:52 +0100, Stut wrote: > Robert Cummings wrote: > > On Wed, 2007-07-11 at 09:46 +0100, Robin Vickery wrote: > >> On 11/07/07, kvigor <[EMAIL PROTECTED]> wrote: > >>> Is there a php function similar to in_array that can detect if a "partial > >>> value" is in an array value o

Re: [PHP] Array Question

2007-07-11 Thread Stut
Robert Cummings wrote: On Wed, 2007-07-11 at 09:46 +0100, Robin Vickery wrote: On 11/07/07, kvigor <[EMAIL PROTECTED]> wrote: Is there a php function similar to in_array that can detect if a "partial value" is in an array value or not: e.g. $var1 = " big horse";$var2 = " small yellow";

Re: [PHP] Array Question

2007-07-11 Thread Robert Cummings
On Wed, 2007-07-11 at 09:46 +0100, Robin Vickery wrote: > On 11/07/07, kvigor <[EMAIL PROTECTED]> wrote: > > Is there a php function similar to in_array that can detect if a "partial > > value" is in an array value or not: > > > > e.g. > > > > $var1 = " big horse";$var2 = " small yellow";$v

Re: [PHP] Array Question

2007-07-11 Thread kvigor
Thanks, I've seen the light by your code. ""Robin Vickery"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 11/07/07, kvigor <[EMAIL PROTECTED]> wrote: >> Is there a php function similar to in_array that can detect if a "partial >> value" is in an array value or not: >> >> e.g.

Re: [PHP] Array Question

2007-07-11 Thread Robin Vickery
On 11/07/07, kvigor <[EMAIL PROTECTED]> wrote: Is there a php function similar to in_array that can detect if a "partial value" is in an array value or not: e.g. $var1 = " big horse";$var2 = " small yellow";$var3 = " red hydrant"; $theArray = array(big blue horse, small yellow bird, gi

[PHP] Array Question

2007-07-10 Thread kvigor
Is there a php function similar to in_array that can detect if a "partial value" is in an array value or not: e.g. $var1 = " big horse";$var2 = " small yellow";$var3 = " red hydrant"; $theArray = array(big blue horse, small yellow bird, giant red hydrant); Is there a way to find out if

Re: [PHP] Array Question

2007-03-25 Thread Stut
[EMAIL PROTECTED] wrote: $count=count($data->legs->leg); $k=0; while($k < $count) { $legrow["$data->legs->leg[$k]['legId']"]=$data->legs->leg[$k]['depApt'].$VM.$data->legs->leg[$k]['depTime'].$VM.$data->legs->leg[$k]['dstApt'].$VM.$data->legs->leg[$k

RE: [PHP] Array Question

2007-03-24 Thread Jake McHenry
MAIL PROTECTED] > Sent: Sunday, March 25, 2007 12:09 AM > To: Jake McHenry > Cc: php-general@lists.php.net > Subject: RE: [PHP] Array Question > > Hi Jake > > I am getting nothing at all. > > Regards > > Richard > > > What is the result your get

RE: [PHP] Array Question

2007-03-24 Thread rluckhurst
> Cc: php-general@lists.php.net >> Subject: RE: [PHP] Array Question >> >> Hi Jake >> >> I tried that and got the same result. >> >> Regards >> >> Richard >> >> > What if you put $temp = $data->legs-&

RE: [PHP] Array Question

2007-03-24 Thread Jake McHenry
What is the result your getting? Jake > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Saturday, March 24, 2007 11:57 PM > To: Jake McHenry > Cc: php-general@lists.php.net > Subject: RE: [PHP] Array Question > > Hi Jake >

RE: [PHP] Array Question

2007-03-24 Thread rluckhurst
gt; From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >> Sent: Saturday, March 24, 2007 11:27 PM >> To: php-general@lists.php.net >> Subject: [PHP] Array Question >> >> Hi All >> >> I am having a bit of trouble with PHP arrays and would >> appreciate so

RE: [PHP] Array Question

2007-03-24 Thread rluckhurst
gt; $legrow["$data->legs->leg[$k]['legId']"] > > ?? See if that works... > > Jake > > > >> -Original Message- >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >> Sent: Saturday, March 24, 2007 11:27 PM >> To: php-gener

RE: [PHP] Array Question

2007-03-24 Thread Jake McHenry
o: php-general@lists.php.net > Subject: [PHP] Array Question > > Hi All > > I am having a bit of trouble with PHP arrays and would > appreciate some help. > > I currently have the following piece of code > > $count=count($data->legs->leg); > $k=0; >

RE: [PHP] Array Question

2007-03-24 Thread Jake McHenry
$legrow["$data->legs->leg[$k]['legId']"] ?? See if that works... Jake > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Saturday, March 24, 2007 11:27 PM > To: php-general@lists.php.net > Subject: [PHP] Array Qu

[PHP] Array Question

2007-03-24 Thread rluckhurst
Hi All I am having a bit of trouble with PHP arrays and would appreciate some help. I currently have the following piece of code $count=count($data->legs->leg); $k=0; while($k < $count) { $legrow[$k]=$data->legs->leg[$k]['legId'].$VM.$data->

Re: [PHP] Array question

2007-02-27 Thread Gerry D
Mike, See entire function under topic "Array question - maybe UTF?"... I am trying to change accented characters to their equivalent without accents. And yes, the arrays look fine after var_dump()... Gerry On 2/27/07, Ford, Mike <[EMAIL PROTECTED]> wrote: On 27 February 2007 04:23, Gerry D w

RE: [PHP] Array question

2007-02-27 Thread Ford, Mike
On 27 February 2007 04:23, Gerry D wrote: > I have a question on how to retrieve the value that corresponds to a > key in an array. > > $fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry'); > > $key = array_search($c, $fruit); > if ( $key === FALSE ) >

[PHP] Array question - maybe UTF?

2007-02-26 Thread Gerry D
Perhaps it's more a UTF8 issue that is going wrong for me. At first strtr() was not giving me the results I wanted, so I started tinkering. This is what I came up with... Still no satisfactory results. I think character support is rather lacking in php, or maybe I just don't have a clue? Gerry

Re: [PHP] Array question

2007-02-26 Thread Hap-Hang Yu
Try: $fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry'); $search = 'apple'; foreach($fruit as $key => $val) { if ($val == $search) { echo "$search found: array key is $key, value is $val"; } } 2007/2/27, Gerry D <[EMAIL PROTECTED]>: I have a question on how to retrieve t

[PHP] Array question

2007-02-26 Thread Gerry D
I have a question on how to retrieve the value that corresponds to a key in an array. $fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry'); $key = array_search($c, $fruit); if ( $key === FALSE ) $n = $c; else

[PHP] Array Question again

2006-03-29 Thread cybermalandro cybermalandro
Let me try this again. I want to take an array that may look like this array(2) { [0]=> array(8) { ["line"]=> string(1) "1" ["ponbr"]=> string(5) "TEST1" ["emt"]=> string(3) "yes" ["qty"]=> string(1) "5" ["price"]=> string(2) "19" ["shipdate"]=>

[PHP] Array Question

2006-03-29 Thread cybermalandro cybermalandro
So, I have an array that looks like this rray(3) { [0]=> array(8) { ["line"]=> string(1) "1" ["ponbr"]=> string(5) "34474" ["emt"]=> string(3) "yes" ["qty"]=> string(1) "5" ["price"]=> string(2) "19" ["shipdate"]=> string(8) "11/06/07" ["tra

[PHP] array question: fixed

2005-09-13 Thread matt VanDeWalle
hey, thanks for jogging my memory about the array_keys ; that was exactly what i wanted, now I don't have to run the program through the more program now, and i got all the names of the arrays in the big array without having half of the info scrolling off the screen. thanks matt -- PHP General

Re: [PHP] PHP Array question

2005-02-15 Thread Matt M.
> What I want to do is to only show 20 pictures at a time with a "Next" link > and a "Previous" link. For the first 20 only the "Next" link would show and > whenever the last set would show only the "Previous" link would. Every other > time both would show. > > Can someone point me in the right di

[PHP] PHP Array question

2005-02-15 Thread R. Van Tassel
I have an array with image names like: $arrayone = array("1.jpg", "2.jpg"); $arraytwo = array("a.jpg", "b.jpg"); Then I have a variable for each to count the number of elements: $arrayoneElements = count($arrayone); $arraytwoElements = count($arraytwo); I'm using the element

RE: [PHP] php array question

2004-11-01 Thread Zareef Ahmed
>-Original Message- >From: Victor C. [mailto:[EMAIL PROTECTED] >Sent: Tuesday, November 02, 2004 3:06 AM >To: [EMAIL PROTECTED] >Subject: [PHP] php array question > > >Hi, >I have a line of php that I don't really understand. > >foreach($this->

[PHP] Re: php array question

2004-11-01 Thread Victor C.
Hi Ben, I tried your portion of code and find out what was wrong... Apparently I used & in adding order to the array and that was messing things up... Everything is working now. Thanks for all the help "Victor C." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I did a print_r(a

[PHP] Re: php array question

2004-11-01 Thread Ben Ramsey
Victor C. wrote: I did a print_r(array_values)before calling the codes that had errors in it.. the following content is contained in $this->orders; Aaaghh. Can you give that to us in pre-formatted text, rather than copying and pasting it from the browser. My eyes are going everywhere trying t

[PHP] Re: php array question

2004-11-01 Thread Victor C.
I did a print_r(array_values)before calling the codes that had errors in it.. the following content is contained in $this->orders; Array ( [0] => order Object ( [UserObject] => user Object ( [UserID] => E2401 [Pass] => [IsValid] => 1 [UserType] => AT [fonthtml] => [footerfile] => resources/foo

[PHP] Re: php array question

2004-11-01 Thread Ben Ramsey
Ben Ramsey wrote: Victor C. wrote: $OrderObject =$this->orders[$OrderID=>$value]; This line is confusing. $OrderID=>$value is either a typo or is just plain wrong. It looks like what it's meant to say is: $OrderObject = $this->orders[$OrderID]; But this will just set $OrderObject equal to $v

[PHP] Re: php array question

2004-11-01 Thread Victor C.
But why would the this line generate different OrderID on lines 1 and 3? "Ben Ramsey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Victor C. wrote: > > $OrderObject =$this->orders[$OrderID=>$value]; > > This line is confusing. $OrderID=>$value is either a typo or is just > plai

[PHP] Re: php array question

2004-11-01 Thread Ben Ramsey
Victor C. wrote: $OrderObject =$this->orders[$OrderID=>$value]; This line is confusing. $OrderID=>$value is either a typo or is just plain wrong. It looks like what it's meant to say is: $OrderObject = $this->orders[$OrderID]; But this will just set $OrderObject equal to $value, so you should

[PHP] php array question

2004-11-01 Thread Victor C.
Hi, I have a line of php that I don't really understand. foreach($this->orders as $OrderID => $value) { echo $OrderID.""; $OrderObject =$this->orders[$OrderID=>$value]; echo $OrderObject->OrderID."<--all the same"; } I know that $this->orders is an array of "order" objects. the resul

[PHP] Array Question

2004-05-02 Thread Jason Williard
I am using the following array and function in the template for my website. It works great, but I want to to be better. I would to make it so the last item displayed looks differently than the others, but I have been unable to figure out how to distinguish the last item. When displayed, the crumb

Re: [PHP] Array Question

2004-02-28 Thread Michal Migurski
>I would like to search an array to see if the value of the variable $url >exists in this array. The array would look like: in_array() - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.

[PHP] Array Question

2004-02-28 Thread Jason Williard
I would like to be able to search an array for a match the a specific variable. So far, I have been trying to use preg_grep but am not getting the results that I want. Basically, I would have a variable: $url = "domain.com" I would like to search an array to see if the value of the variable $url

Re: [PHP] Array question

2003-09-27 Thread Cristian Lavaque
http://www.php.net/manual/en/language.types.array.php If you mean having an array inside an array, of course . There you have an array inside another one, 'data' will be here $var['0']['0']. If you meant using an array item as the key in another array, then you do it as with a normal var . Rememb

Re: [PHP] Array question

2003-09-27 Thread Jackson Miller
On Saturday 27 September 2003 11:18, Robin Kopetzky wrote: > Good morning all!! > > Can you nest an array within an array?? > > Example: $paArgs['aCheckBoxes[$iIndex]['sName']'] Yes, but like this $array['aCheckBoxes'][] = $iIndex['sName'] This means: $array is an array aCheckBoxes is a item in $

Re: [PHP] Array question

2003-09-27 Thread Robert Cummings
On Sat, 2003-09-27 at 12:18, Robin Kopetzky wrote: > Good morning all!! > > Can you nest an array within an array?? > > Example: $paArgs['aCheckBoxes[$iIndex]['sName']'] You mean can you retrieve an array entry by giving a key defined by a value in another array? To do so remove the outer quotes

[PHP] Array question

2003-09-27 Thread Robin Kopetzky
Good morning all!! Can you nest an array within an array?? Example: $paArgs['aCheckBoxes[$iIndex]['sName']'] Thank you in advance. Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://ww

Re: [PHP] Array Question

2003-07-28 Thread Jim Lucas
Try this. $companyname[] = $row['company']; Jim Lucas - Original Message - From: "Pushpinder Singh Garcha" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, July 28, 2003 10:16 AM Subject: [PHP] Array Question hello everyone, I am trying t

[PHP] Array Question

2003-07-28 Thread Pushpinder Singh Garcha
hello everyone, I am trying to store one of the fields of the resultset into an array as I display the results. while ($row = mysql_fetch_array($result1)) { // Alternate the bgcolor of each row for visibility ($even % 2) == 0 ? $bgcolor = "#EFEFEF" : $bgcolor = "#eefff

Re: [PHP] ARRAY QUESTION

2003-07-24 Thread Curt Zirzow
* Thus wrote Dale Hersh ([EMAIL PROTECTED]): > I have a question regarding the count function. Here goes: > > Lets pretend I have this array called myStuff. If I add two elements to > myStuff and call the count function, I will get a result of 2. My question > is how do I re-initialize the array a

RE: [PHP] ARRAY QUESTION

2003-07-24 Thread Chris W. Parker
Dale Hersh on Thursday, July 24, 2003 12:41 PM said: > Lets pretend I have this array called myStuff. If I add two elements > to myStuff and call the count function, I will get a result of 2. My > question is how do I re-initialize the array after adding elements so

RE: [PHP] ARRAY QUESTION

2003-07-24 Thread Jay Blanchard
[snip] Lets pretend I have this array called myStuff. If I add two elements to myStuff and call the count function, I will get a result of 2. My question is how do I re-initialize the array after adding elements so when I call the count function on the array, I get a result of 0. [/snip] If you ad

[PHP] ARRAY QUESTION

2003-07-24 Thread Dale Hersh
I have a question regarding the count function. Here goes: Lets pretend I have this array called myStuff. If I add two elements to myStuff and call the count function, I will get a result of 2. My question is how do I re-initialize the array after adding elements so when I call the count function

Re: [PHP] array question

2003-05-30 Thread Randy Johnson
I found this in the manual user comments and it worked great mysql_data_seek($result,0); Randy - Original Message - From: "Randy Johnson" <[EMAIL PROTECTED]> To: "Brian Dunning" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, May 29, 2003

[PHP] array question

2003-05-30 Thread Randy Johnson
How do I access the data in $query_data after I go through the while loop, here is an example $result=mysql_query($query,$link); while ($query_data=mysql_fetch_array($result) ) { $var1=$query_data["var1"]; $var1=$query_data["var1"]; } after the while is done, How do I access the data in q

Re: [PHP] Array Question

2003-04-01 Thread Rob Adams
Creating an array that holds the 11 combined records from the two tables, and sorting the array according to date: (This depends on what type your using to store dates in MySQL, and that the exact date is unique for each record across both tables. If the date isn't unique, it requires a little mo

Re: [PHP] Array Question

2003-04-01 Thread Tim Burden
rning. http://www.mysql.com/doc/en/MERGE.html - Original Message - From: "Mark McCulligh" <[EMAIL PROTECTED]> Newsgroups: php.general To: <[EMAIL PROTECTED]> Sent: Tuesday, April 01, 2003 12:33 PM Subject: Re: [PHP] Array Question > I have looked at the differ

Re: [PHP] Array Question

2003-04-01 Thread Mark McCulligh
I have looked at the different JOINs but I can't link any fields together. There is no relationship between the tables. The two table are basically the same table. But the DBA didn't make them one like he should have. Mark. "Skate" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] look

Re: [PHP] Array Question

2003-04-01 Thread Mark McCulligh
I can't link the two tables at all. I need to loop through one displaying its information, then loop through the other table displaying its information. For if I have 5 records in table A and 6 records in table B, I get 11 records total. Each table only has 4-5 fields and they exist in both table

Re: [PHP] Array Question

2003-04-01 Thread Chris Hayes
At 18:58 1-4-03, you wrote: I have two tables that I want to display together as if they were one table and order them by a common date field. Because I am using MySQL I can't use the usually way I would do this. Create a store procedure or view. Does every row in tableA has a sibling row in tableB

Re: [PHP] Array Question

2003-04-01 Thread skate
look into things like JOIN and SORT BY in MySQL, they're quicker and more efficient than PHP for doing DB stuff (so i'm told) took me awhile to get my head around JOIN, but once you've got it, you'll never be without it ;) "Mark McCulligh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTE

[PHP] Array Question

2003-04-01 Thread Mark McCulligh
I have two tables that I want to display together as if they were one table and order them by a common date field. Because I am using MySQL I can't use the usually way I would do this. Create a store procedure or view. I was thinking of creating two separate queries in PHP then loading the data i

RE: [PHP] array question

2003-03-10 Thread Ford, Mike [LSS]
> -Original Message- > From: Jason Wong [mailto:[EMAIL PROTECTED] > Sent: 10 March 2003 15:35 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] array question > > > On Monday 10 March 2003 21:13, Diana Castillo wrote: > > If I sort an array, and now the keys are

Re: [PHP] array question

2003-03-10 Thread Ernest E Vogelsinger
At 16:35 10.03.2003, Jason Wong said: [snip] >Not very elegant -- there must be a better way? > >foreach ($doo as $key => $value) { > print "Key:$key Value:$value"; > break; >} [snip] Possibly using array_keys()?

Re: [PHP] array question

2003-03-10 Thread Jason Wong
On Monday 10 March 2003 21:13, Diana Castillo wrote: > If I sort an array, and now the keys are not in numerical order, how can I > get the key of the first element? > If I do array_shift I get the first element but I want that key. Not very elegant -- there must be a better way? foreach ($doo as

[PHP] array question

2003-03-10 Thread Diana Castillo
If I sort an array, and now the keys are not in numerical order, how can I get the key of the first element? If I do array_shift I get the first element but I want that key. Thanks, Diana -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] array question

2003-02-24 Thread Johnson, Kirk
http://www.php.net/manual/en/language.variables.variable.php Kirk > -Original Message- > From: Bob Irwin [mailto:[EMAIL PROTECTED] > Sent: Monday, February 24, 2003 3:28 PM > To: php-general > Subject: Re: [PHP] array question > > > Hi Guys, > > Th

Re: [PHP] array question

2003-02-24 Thread Bob Irwin
Hi Guys, This might be a bit of a newbie question, but I'm not sure how to search for this particular information as its hard to put in search terms. Say I have a mysql/file with information about variables. Eg, I have a string from a mysql database of 'test' Am I able to then, in PHP, assign

Re: [PHP] array question

2003-02-24 Thread Chris Edwards
as $k => $v) echo $v; } -- Chris Edwards Web Application Developer Outer Banks Internet, Inc. 252-441-6698 [EMAIL PROTECTED] http://www.OuterBanksInternet.com - Original Message ----- From: "Richard Kurth" <[EMAIL PROTECTED]> To: "php-general" <[EMAIL PROTECTED]

[PHP] array question

2003-02-24 Thread Richard Kurth
This is the code I am using to get the data out of the text file below. Now I need to turn the $group[3] into an array of its own so that I can make changes to it. How do I turn this into an array that I can reference with $group[0]. What I need to be able to do is search for the label in $group[0]

Re: [PHP] array question

2002-10-30 Thread Philip Olson
e information on using them. http://www.php.net/manual/en/language.types.array.php Regards, Philip On Wed, 30 Oct 2002, Rick Emery wrote: > What does you HTML look like? > - Original Message - > From: "John Meyer" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent:

Re: [PHP] array question

2002-10-30 Thread @ Edwin
Hello, "John Meyer" <[EMAIL PROTECTED]> wrote: > Either way, I'm not getting the interests. > ...[snip]... > > When retrieving an array from $_POST, which is the right way: > > $arrInterests = $_POST["interests[]"]; > > or > $arrInterests = $_POST["interests"]; > Try this instead: $arrI

Re: [PHP] array question

2002-10-30 Thread Rick Emery
What does you HTML look like? - Original Message - From: "John Meyer" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 30, 2002 10:36 AM Subject: RE: [PHP] array question Either way, I'm not getting the interests. -Original Me

RE: [PHP] array question

2002-10-30 Thread John Meyer
Either way, I'm not getting the interests. -Original Message- From: Rick Emery [mailto:remery@;emeryloftus.com] Sent: Wednesday, October 30, 2002 9:34 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] array question What happened when you tried both methods? - Original Me

Re: [PHP] array question

2002-10-30 Thread Rick Emery
What happened when you tried both methods? - Original Message - From: "John Meyer" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 30, 2002 10:29 AM Subject: [PHP] array question When retrieving an array from $_POST, which is the right way:

[PHP] array question

2002-10-30 Thread John Meyer
When retrieving an array from $_POST, which is the right way: $arrInterests = $_POST["interests[]"]; or $arrInterests = $_POST["interests"]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Array Question

2002-10-30 Thread Ford, Mike [LSS]
> -Original Message- > From: PHP List [mailto:php_list@;ibcnetwork.net] > Sent: 29 October 2002 17:20 > To: php > Subject: Re: [PHP] Array Question > > > No, array_keys does not do what I want, in order to user > array_keys, it > assumes I know the valu

Re: [PHP] Array Question

2002-10-29 Thread PHP List
No, array_keys does not do what I want, in order to user array_keys, it assumes I know the value of the key, but I don't, I want to get the value of the key but all I know is the index. > Perhaps you want to look at array_keys(). > > On Monday, October 28, 2002, at 05:48 PM, PHP List wrote: > > >

Re: [PHP] Array Question

2002-10-29 Thread Brent Baisley
Perhaps you want to look at array_keys(). On Monday, October 28, 2002, at 05:48 PM, PHP List wrote: How can I get the name of the index? -- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 --

RE: [PHP] Array Question

2002-10-29 Thread Ford, Mike [LSS]
> -Original Message- > From: PHP List [mailto:php_list@;ibcnetwork.net] > Sent: 28 October 2002 22:48 > To: php > Subject: [PHP] Array Question > > > Hi, > Lets say I have a simple array like this: > $myarray = array("a"=>"b","d&q

Re: [PHP] Array Question

2002-10-28 Thread PHP List
This doesn't seem to work for anything past the first key: echo array_search(0,$myarray); will print 'a'; None of these give me anything: echo array_search(1,$myarray); echo array_search("1",$myarray); echo array_search(1,$myarray,true); echo array_search("1",$myarray,true); so how do I get 'd'?

Re: [PHP] Array Question

2002-10-28 Thread Rasmus Lerdorf
I think you are looking for array_search() On Mon, 28 Oct 2002, PHP List wrote: > Hi, > Lets say I have a simple array like this: > $myarray = array("a"=>"b","d"=>"c"); > > echo $myarray[0] will return 'b'; > > How can I get the name of the index? so: > > echo $myarray[something] would return 'a'

[PHP] Array Question

2002-10-28 Thread PHP List
Hi, Lets say I have a simple array like this: $myarray = array("a"=>"b","d"=>"c"); echo $myarray[0] will return 'b'; How can I get the name of the index? so: echo $myarray[something] would return 'a'; I know I can do a list($key,$value) but I don't need to loop through the array, I just need t

  1   2   >