Re: [PHP] Array remove function?

2007-04-10 Thread Tijnema !
On 4/10/07, Richard Lynch [EMAIL PROTECTED] wrote: http://php.net/unset That works when you know the key, but will that work when you only know the value? Tijnema On Tue, April 10, 2007 2:49 pm, Tijnema ! wrote: Hi, Is there currently a function that removes a key/value from an array?

RE: [PHP] Array remove function?

2007-04-10 Thread Daevid Vincent
While that is true, you need to know the key, you could do something like this, which I think is more efficient than your way... foreach($array as $key = $value) { if ($value == $remove) { unset($array[$key]); //if you know there is only one hit,

RE: [PHP] Array remove function?

2007-04-10 Thread Buesching, Logan J
! [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 10, 2007 3:53 PM To: [EMAIL PROTECTED] Cc: PHP Subject: Re: [PHP] Array remove function? On 4/10/07, Richard Lynch [EMAIL PROTECTED] wrote: http://php.net/unset That works when you know the key, but will that work when you only know the value

Re: [PHP] Array remove function?

2007-04-10 Thread Lori Lay
Tijnema ! wrote: On 4/10/07, Richard Lynch [EMAIL PROTECTED] wrote: http://php.net/unset That works when you know the key, but will that work when you only know the value? Tijnema Use array_search() and unset()? Lori On Tue, April 10, 2007 2:49 pm, Tijnema ! wrote: Hi, Is there

RE: [PHP] Array remove function?

2007-04-10 Thread Daevid Vincent
OMG. Now that is the best idea. How simple. Guess I learned something new today too! :) -Original Message- From: Lori Lay [mailto:[EMAIL PROTECTED] Use array_search() and unset()? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Array remove function?

2007-04-10 Thread tg-php
Unset works, but if he's trying to do a search and remove in one function, unset is a step removed from that criteria (missing the 'search' part). Looking at the array functions, I see some potential. # array_remove(array(1=2,2=3),2,true); // array (2=3) // Keep all but where values = 2

Re: [PHP] Array remove function?

2007-04-10 Thread Tijnema !
On 4/10/07, Daevid Vincent [EMAIL PROTECTED] wrote: OMG. Now that is the best idea. How simple. Guess I learned something new today too! :) -Original Message- From: Lori Lay [mailto:[EMAIL PROTECTED] Use array_search() and unset()? Interesting, I didn't thought of that :) But

Re: [PHP] Array remove function?

2007-04-10 Thread Lori Lay
Tijnema ! wrote: On 4/10/07, Daevid Vincent [EMAIL PROTECTED] wrote: OMG. Now that is the best idea. How simple. Guess I learned something new today too! :) -Original Message- From: Lori Lay [mailto:[EMAIL PROTECTED] Use array_search() and unset()? Interesting, I didn't thought

[PHP] Copying PHP array into a Javascript array

2007-04-10 Thread Otto Wyss
I don't know if I should ask this question here or in the JavaScript group. I'll try it here since people usually are more helpful. I've an array of file names $files = getFiles ($d); but would like to use this array in a JavaScript array. How can I copy this $files into a JavaScript

RE: [PHP] Copying PHP array into a Javascript array

2007-04-10 Thread Buesching, Logan J
Although it looks nasty, I believe it could be a quick hack. -Original Message- From: Otto Wyss [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 10, 2007 4:37 PM To: php-general@lists.php.net Subject: [PHP] Copying PHP array into a Javascript array I don't know if I should ask

Re: [PHP] Copying PHP array into a Javascript array

2007-04-10 Thread Jochem Maas
Otto Wyss wrote: I don't know if I should ask this question here or in the JavaScript group. I'll try it here since people usually are more helpful. I've an array of file names $files = getFiles ($d); but would like to use this array in a JavaScript array. How can I copy this $files

Re: [PHP] Copying PHP array into a Javascript array

2007-04-10 Thread Otto Wyss
Jochem Maas wrote: // if you have this available: http://php.net/manual/en/function.json-encode.php echo json_encode($files); I thought there might be a solution with Json but couldn't locate it. I prefer it versus the iteration, thanks. Sometimes solutions are so simple if one knows them.

RE: [PHP] Copying PHP array into a Javascript array

2007-04-10 Thread Peter Lauri
10, 2007 10:37 PM To: php-general@lists.php.net Subject: [PHP] Copying PHP array into a Javascript array I don't know if I should ask this question here or in the JavaScript group. I'll try it here since people usually are more helpful. I've an array of file names $files = getFiles ($d

Re: [PHP] Array remove function?

2007-04-10 Thread Richard Lynch
http://php.net/array_flip followed up an unset, followed by another array_flip, I guess... Why in the world you'd architect the array with a value when you need to unset by value in the first place is beyond me, though... On Tue, April 10, 2007 2:52 pm, Tijnema ! wrote: On 4/10/07, Richard

Re: [PHP] Array remove function?

2007-04-10 Thread M.Sokolewicz
Lori Lay wrote: Tijnema ! wrote: On 4/10/07, Daevid Vincent [EMAIL PROTECTED] wrote: OMG. Now that is the best idea. How simple. Guess I learned something new today too! :) -Original Message- From: Lori Lay [mailto:[EMAIL PROTECTED] Use array_search() and unset()? Interesting,

Re: [PHP] Array remove function?

2007-04-10 Thread Richard Lynch
On Tue, April 10, 2007 3:22 pm, Tijnema ! wrote: On 4/10/07, Daevid Vincent [EMAIL PROTECTED] wrote: OMG. Now that is the best idea. How simple. Guess I learned something new today too! :) -Original Message- From: Lori Lay [mailto:[EMAIL PROTECTED] Use array_search() and

Re: [PHP] Copying PHP array into a Javascript array

2007-04-10 Thread Paul Novitski
At 4/10/2007 01:36 PM, Otto Wyss wrote: I've an array of file names $files = getFiles ($d); but would like to use this array in a JavaScript array. How can I copy this $files into a JavaScript variable? As I'm sure you know, you can't literally copy the values from PHP into the

Re: [PHP] Array remove function?

2007-04-10 Thread Paul Novitski
At 4/10/2007 03:09 PM, M.Sokolewicz wrote: Such a function is inherently a Bad Idea (tm). array-values are not unique. Array keys are. So unless you want to emulate the way array_flip works (bad idea (tm)), I'd say: leave it be. Whoever owns that trademark has totally got to be the

Re: [PHP] Array remove function?

2007-04-10 Thread Richard Lynch
On Tue, April 10, 2007 5:39 pm, Paul Novitski wrote: values. If both keys and values are unique, I'd consider (if only briefly) maintaining two arrays, one a flipped version of the other, so I could look up key/value pairs using either node. I do this all the time for small/medium arrays.

Re: [PHP] Array Question

2007-03-25 Thread Stut
[EMAIL PROTECTED] wrote: $count=count($data-legs-leg); $k=0; while($k $count) {

[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) {

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 Question Hi All I am having a bit of trouble

RE: [PHP] Array Question

2007-03-24 Thread Jake McHenry
What if you put $temp = $data-legs-leg[$k]['legId']; And then put that into $legrow[$temp]; Do you have anything in $temp? 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

RE: [PHP] Array Question

2007-03-24 Thread rluckhurst
-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 Question Hi All I am having a bit of trouble with PHP arrays and would

RE: [PHP] Array Question

2007-03-24 Thread rluckhurst
, 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 some help. I currently have the following piece of code $count=count($data-legs-leg); $k=0; while($k $count

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 I tried that and got the same result

RE: [PHP] Array Question

2007-03-24 Thread rluckhurst
Hi Jake I am getting nothing at all. Regards Richard 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

RE: [PHP] Array Question

2007-03-24 Thread Jake McHenry
: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 getting? Jake -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent

Re: [PHP] Array mysteries

2007-03-12 Thread Richard Lynch
Read the manual again, especially the part about variable scope near the beginning. On Sun, March 11, 2007 3:51 am, Otto Wyss wrote: I want to convert weekdays with a simple function like $wdays = array (0 = Sonntag ,1 = Montag ,2 = Dienstag ,3 = Mittwoch ,4

Re: [PHP] Array mysteries

2007-03-12 Thread Richard Lynch
On Sun, March 11, 2007 12:02 pm, Edward Vermillion wrote: On Mar 11, 2007, at 10:02 AM, tedd wrote: At 3:05 PM +0100 3/11/07, Tijnema ! wrote: On 3/11/07, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: At 10:05 AM +0100 3/11/07, Tijnema ! wrote: - You could define $wdays inside

Re: [PHP] Array mysteries

2007-03-12 Thread Richard Lynch
On Sun, March 11, 2007 2:57 pm, Edward Vermillion wrote: Would the array lookup be faster for a lesser-used option/key in a situation where there were quite a few options? (you wouldn't have to go through the whole switch to get to the option at the end (?) or would you? I have no idea how

[PHP] Array mysteries

2007-03-11 Thread Otto Wyss
I want to convert weekdays with a simple function like $wdays = array (0 = Sonntag ,1 = Montag ,2 = Dienstag ,3 = Mittwoch ,4 = Donnerstag ,5 = Freitag ,6 = Samstag ); function convert_from_weekday ($weekday) { return $wdays[$weekday]; } but this doesn't

Re: [PHP] Array mysteries

2007-03-11 Thread Tijnema !
On 3/11/07, Otto Wyss [EMAIL PROTECTED] wrote: I want to convert weekdays with a simple function like $wdays = array (0 = Sonntag ,1 = Montag ,2 = Dienstag ,3 = Mittwoch ,4 = Donnerstag ,5 = Freitag ,6 = Samstag ); function convert_from_weekday ($weekday) {

Re: [PHP] Array mysteries

2007-03-11 Thread Steve Edberg
At 9:51 AM +0100 3/11/07, Otto Wyss wrote: I want to convert weekdays with a simple function like $wdays = array (0 = Sonntag ,1 = Montag ,2 = Dienstag ,3 = Mittwoch ,4 = Donnerstag ,5 = Freitag ,6 = Samstag ); function convert_from_weekday ($weekday) {

Re: [PHP] Array mysteries

2007-03-11 Thread Otto Wyss
Steve Edberg wrote: At 9:51 AM +0100 3/11/07, Otto Wyss wrote: function convert_from_weekday ($weekday) { return $wdays[$weekday]; } If the above is your exact code, then the problem is one of scope; move the $wdays declaration inside your convert_from_weekday() function. I'm

Re: [PHP] Array mysteries

2007-03-11 Thread Satyam
- Original Message - From: Otto Wyss [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Sunday, March 11, 2007 11:14 AM Subject: Re: [PHP] Array mysteries Steve Edberg wrote: At 9:51 AM +0100 3/11/07, Otto Wyss wrote: function convert_from_weekday ($weekday) { return

Re: [PHP] Array mysteries

2007-03-11 Thread tedd
At 10:05 AM +0100 3/11/07, Tijnema ! wrote: - You could define $wdays inside the function function convert_from_weekday ($weekday,$wdays) { $wdays = array (0 = Sonntag ,1 = Montag ,2 = Dienstag ,3 = Mittwoch ,4 = Donnerstag ,5 = Freitag ,6 = Samstag ); return

Re: [PHP] Array mysteries

2007-03-11 Thread Tijnema !
On 3/11/07, tedd [EMAIL PROTECTED] wrote: At 10:05 AM +0100 3/11/07, Tijnema ! wrote: - You could define $wdays inside the function function convert_from_weekday ($weekday) { $wdays = array (0 = Sonntag ,1 = Montag ,2 = Dienstag ,3 = Mittwoch ,4 = Donnerstag ,5 =

Re: [PHP] Array mysteries

2007-03-11 Thread tedd
At 3:05 PM +0100 3/11/07, Tijnema ! wrote: On 3/11/07, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: At 10:05 AM +0100 3/11/07, Tijnema ! wrote: - You could define $wdays inside the function function convert_from_weekday ($weekday) { $wdays = array (0 = Sonntag ,1 = Montag ,2

Re: [PHP] Array mysteries

2007-03-11 Thread Edward Vermillion
On Mar 11, 2007, at 10:02 AM, tedd wrote: At 3:05 PM +0100 3/11/07, Tijnema ! wrote: On 3/11/07, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: At 10:05 AM +0100 3/11/07, Tijnema ! wrote: - You could define $wdays inside the function function convert_from_weekday ($weekday) { $wdays

Re: [PHP] Array mysteries

2007-03-11 Thread Larry Garfield
On Sunday 11 March 2007 12:02 pm, Edward Vermillion wrote: At 10:05 AM +0100 3/11/07, Tijnema ! wrote: - You could define $wdays inside the function function convert_from_weekday ($weekday) { $wdays = array (0 = Sonntag ,1 = Montag ,2 = Dienstag ,3 = Mittwoch ,4 =

Re: [PHP] Array mysteries

2007-03-11 Thread tedd
At 12:02 PM -0500 3/11/07, Edward Vermillion wrote: On Mar 11, 2007, at 10:02 AM, tedd wrote: At 3:05 PM +0100 3/11/07, Tijnema ! wrote: On 3/11/07, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: At 10:05 AM +0100 3/11/07, Tijnema ! wrote: - You could define $wdays inside the

Re: [PHP] Array mysteries

2007-03-11 Thread Edward Vermillion
On Mar 11, 2007, at 1:59 PM, tedd wrote: At 12:02 PM -0500 3/11/07, Edward Vermillion wrote: On Mar 11, 2007, at 10:02 AM, tedd wrote: At 3:05 PM +0100 3/11/07, Tijnema ! wrote: On 3/11/07, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: At 10:05 AM +0100 3/11/07, Tijnema ! wrote:

Re: [PHP] Array mysteries

2007-03-11 Thread Satyam
- Original Message - From: Edward Vermillion [EMAIL PROTECTED] To: tedd [EMAIL PROTECTED] Cc: Tijnema ! [EMAIL PROTECTED]; php-general@lists.php.net Sent: Sunday, March 11, 2007 8:57 PM Subject: Re: [PHP] Array mysteries On Mar 11, 2007, at 1:59 PM, tedd wrote: At 12:02 PM -0500

Re: [PHP] Array mysteries

2007-03-11 Thread Tijnema !
On 3/11/07, Satyam [EMAIL PROTECTED] wrote: - Original Message - From: Edward Vermillion [EMAIL PROTECTED] To: tedd [EMAIL PROTECTED] Cc: Tijnema ! [EMAIL PROTECTED]; php-general@lists.php.net Sent: Sunday, March 11, 2007 8:57 PM Subject: Re: [PHP] Array mysteries On Mar 11, 2007

Re: [PHP] Array mysteries

2007-03-11 Thread Robert Cummings
On Sun, 2007-03-11 at 21:41 +0100, Satyam wrote: - Original Message - From: Edward Vermillion [EMAIL PROTECTED] To: tedd [EMAIL PROTECTED] Cc: Tijnema ! [EMAIL PROTECTED]; php-general@lists.php.net Sent: Sunday, March 11, 2007 8:57 PM Subject: Re: [PHP] Array mysteries

[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

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 )

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

Re: [PHP] array issues

2007-02-27 Thread Richard Lynch
Just add another array for each with $artist as the key. while ($artist, $vote, $email) = mysql_fetch_row($results)){ $votes[$artist] = $vote; $emails[$artist] = $email; } Although, actually, there is probably some better ways to do what you are doing, but with only the query to look at,

Re: [PHP] array issues

2007-02-27 Thread Jim Lucas
Richard Lynch wrote: Just add another array for each with $artist as the key. while ($artist, $vote, $email) = mysql_fetch_row($results)){ I think you ment while ( list($artist, $vote, $email) = mysql_fetch_row($results) ){ $votes[$artist] = $vote; $emails[$artist] = $email; } Although,

[PHP] array issues

2007-02-26 Thread Steven Macintyre
Hi all, I am working on a project for someone and with the brief I received before - I created a record per action with the following information; Artist[tab]artist[tab]artist[tab] etc as a entry for artists Then I have the same for titles etc ... What I have been doing is creating the

[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 to Object

2007-02-13 Thread Eli
Hi, Having this array: $arr = array( 'my var'='My Value' ); Notice the space in 'my var'. Converted to object: $obj = (object)$arr; How can I access $arr['my var'] in $obj ? -thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Array to Object

2007-02-13 Thread Marc Weber
On Tue, Feb 13, 2007 at 12:02:10PM +0200, Eli wrote: Hi, Having this array: $arr = array( 'my var'='My Value' ); Notice the space in 'my var'. Converted to object: $obj = (object)$arr; How can I access $arr['my var'] in $obj ? This works but there may be much

Re: [PHP] array within array

2007-02-12 Thread Jim Lucas
is not The stuff in bold SHOULD be on a new line ... Can you take a look and offer me more advice? S -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: 09 February 2007 09:56 AM To: Steven Macintyre Subject: Re: [PHP] array within array Steven Macintyre wrote: Hi all, I have an array

Re: [PHP] array within array

2007-02-09 Thread Németh Zoltán
On p, 2007-02-09 at 09:24 +0200, Steven Macintyre wrote: Hi all, I have an array ($articles) that contains content in this format Textbr More text I am currently calling the creation of the array as such; $articles = split(Section break, $mystring); -- this works NOW ... I need to

Re: [PHP] array within array

2007-02-09 Thread Németh Zoltán
On p, 2007-02-09 at 10:10 +0100, Németh Zoltán wrote: On p, 2007-02-09 at 09:24 +0200, Steven Macintyre wrote: Hi all, I have an array ($articles) that contains content in this format Textbr More text I am currently calling the creation of the array as such; $articles =

[PHP] array within array

2007-02-08 Thread Steven Macintyre
Hi all, I have an array ($articles) that contains content in this format Textbr More text I am currently calling the creation of the array as such; $articles = split(Section break, $mystring); -- this works NOW ... I need to split each item in the articles array into its own array (newsarray)

Re: [PHP] array within array

2007-02-08 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-02-09 09:24:01 +0200: I am currently calling the creation of the array as such; $articles = split(Section break, $mystring); -- this works NOW ... I need to split each item in the articles array into its own array (newsarray) I have tried Foreach

[PHP] Array decleration problem

2007-01-03 Thread Delta Storm
Hi, I'm new to php and im learning, I haven't encounter any problems till now so please help me? :) the code: (learning arrays...) ?php $flavors=array (banana, cucumber, grape, vanilla) $flavors2 [0] =3; $flavors2 [1]=13;

Re: [PHP] Array decleration problem

2007-01-03 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-02 10:48:27 +0100: Hi, I'm new to php and im learning, I haven't encounter any problems till now so please help me? :) the code: (learning arrays...) ?php $flavors=array (banana, cucumber, grape, vanilla) that statement is incomplete (;

[PHP] array, classes and values

2006-10-29 Thread martin
hello, New to oop i'm really strugling to find a way to read a specified MYSQL database and tabel in order to determine the number of records, the number of fields in each record and convert the data into their labels and values. Please give me some hints or code... Thanks, Martin -- PHP

Re: [PHP] array, classes and values

2006-10-29 Thread Chris
martin wrote: hello, New to oop i'm really strugling to find a way to read a specified MYSQL database and tabel in order to determine the number of records, the number of fields in each record and convert the data into their labels and values. I suggest you search for php mysql tutorial in

[PHP] array size in bytes

2006-10-02 Thread Roman Rumisek
Hi, Exists in PHP function returning array size in bytes ? (For saving array into shared memory without serialize.) Thnx. Roman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] array size in bytes

2006-10-02 Thread Richard Lynch
On Mon, October 2, 2006 3:07 am, Roman Rumisek wrote: Exists in PHP function returning array size in bytes ? (For saving array into shared memory without serialize.) No. And you could maybe write one, if it was all strings in the array, but you're gonna be screwed when PHP 6 with Unicode comes

Re: [PHP] array size in bytes

2006-10-02 Thread tedd
At 4:18 PM -0500 10/2/06, Richard Lynch wrote: On Mon, October 2, 2006 3:07 am, Roman Rumisek wrote: Exists in PHP function returning array size in bytes ? (For saving array into shared memory without serialize.) No. And you could maybe write one, if it was all strings in the array, but

Re: [PHP] array size in bytes

2006-10-02 Thread Chris Boget
How about saving the array as a file and then do a filesize()? Wouldn't this work? $arraySize = strlen( implode( '', $array )); Though, additional work would need to be done for nested arrays. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

[PHP] array problems

2006-08-16 Thread Chris G
Hi all Having a prob with a php script... 3 arrays $datay1=array(140,110,50,60); $datay2=array(35,90,190,190); $datay3=array(20,60,70,140); which have to be passed to a class like this $gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3)); if I get data from a database, how can I

Re: [PHP] array problems

2006-08-16 Thread David Tulloh
Chris G wrote: Hi all Having a prob with a php script... 3 arrays $datay1=array(140,110,50,60); $datay2=array(35,90,190,190); $datay3=array(20,60,70,140); which have to be passed to a class like this $gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3)); if I get

Re: [PHP] array problems

2006-08-16 Thread John Wells
On 8/16/06, David Tulloh [EMAIL PROTECTED] wrote: Chris G wrote: foreach ($user_input_array as $user_input) { $data_member = array(); # Create an empty array Do SQL query stuff foreach ($sql_results as $sql_member) { $data_member[] = $sql_member;

Re: [PHP] array problems

2006-08-16 Thread Richard Lynch
On Wed, August 16, 2006 1:08 am, Chris G wrote: while($line = mysql_fetch_array($result)) { $data1y[] = $line['rep_value_perc']; $dataly[][] = $line['rep_value_prec']; } This gives me just the one array from the above example, $datay1. How would you dynamically create the all of the

Re: [PHP] Array to String

2006-06-28 Thread Jochem Maas
Richard Lynch wrote: On Mon, June 26, 2006 2:06 am, Jochem Maas wrote: if (!get_magic_quotes_gpc()) { if (isset($_POST)) { foreach ($_POST as $key = $value) { $_POST[$key] = trim(addslashes($value)); } } if (isset($_GET)) { foreach ($_GET

Re: [PHP] Array to String

2006-06-27 Thread Richard Lynch
On Mon, June 26, 2006 2:06 am, Jochem Maas wrote: if (!get_magic_quotes_gpc()) { if (isset($_POST)) { foreach ($_POST as $key = $value) { $_POST[$key] = trim(addslashes($value)); } } if (isset($_GET)) { foreach ($_GET as $key = $value) {

Re: [PHP] Array to String

2006-06-26 Thread Jochem Maas
weetat wrote: Hi all, I have the error below in my PHP version 4.3.2: PHP Notice: Array to string conversion in /data/html/library/config.php on line 45 If i have turned on the magic_quotes in php.ini, it is ok . Any ideas? It cause by the code below: if

[PHP] Array to String

2006-06-25 Thread weetat
Hi all, I have the error below in my PHP version 4.3.2: PHP Notice: Array to string conversion in /data/html/library/config.php on line 45 If i have turned on the magic_quotes in php.ini, it is ok . Any ideas? It cause by the code below: if (!get_magic_quotes_gpc()) { if

Re: [PHP] Array to String

2006-06-25 Thread Chris
You are probably passing some variables into POST or GET using the array notation: /mypage.php?var[]=fredvar[]=wilma $_GET['var'] will be an array inside mypage.php, You should probably check to see if it's an array then, if it is, loop through each element of the var array Chris weetat

[PHP] Array

2006-06-19 Thread Rob W.
$query=SELECT switchport FROM network; $result=mysql_query($query); $sql_range=array($result['switchport']); Anybody tell me what i'm doing wrong and why this isnt going in to an array?

RE: [PHP] Array

2006-06-19 Thread Jay Blanchard
[snip] $query=SELECT switchport FROM network; $result=mysql_query($query); $sql_range=array($result['switchport']); Anybody tell me what i'm doing wrong and why this isnt going in to an array? [/snip] Use mysql_fetch_array() $sql_range = mysql_fetch_array($result); -- PHP General

Re: [PHP] Array

2006-06-19 Thread Brad Bonkoski
Your result variable is a result identifier, not the actual data... check out: http://www.php.net/manual/en/function.mysql-fetch-row.php or something similar... -Brad Rob W. wrote: $query=SELECT switchport FROM network; $result=mysql_query($query); $sql_range=array($result['switchport']);

Re: [PHP] Array

2006-06-19 Thread John Nichel
Rob W. wrote: $query=SELECT switchport FROM network; $result=mysql_query($query); $sql_range=array($result['switchport']); Anybody tell me what i'm doing wrong and why this isnt going in to an array? Because you're not understanding what the function mysql_query() is doing. Look at

[PHP] Array name out of field value with data

2006-05-22 Thread Jonas Rosling
Not so sure if I've tried to work this out before in this list. I'm trying to make an array name by a field/row value and assigning values to it. But I'm having some problems getting it to work. Is it possible to do this? And if, what am I doing wrong? Or is there any other way to do it?

Re: [PHP] Array name out of field value with data

2006-05-22 Thread nicolas figaro
Jonas Rosling a écrit : Not so sure if I've tried to work this out before in this list. I'm trying to make an array name by a field/row value and assigning values to it. But I'm having some problems getting it to work. Is it possible to do this? And if, what am I doing wrong? Or is there any

SV: [PHP] Array name out of field value with data

2006-05-22 Thread Jonas Rosling
-Ursprungligt meddelande- Från: nicolas figaro [mailto:[EMAIL PROTECTED] Skickat: den 22 maj 2006 11:50 Till: PHP List Ämne: Re: [PHP] Array name out of field value with data Jonas Rosling a écrit : Not so sure if I've tried to work this out before in this list. I'm trying to make

Re: [PHP] Array Sorting

2006-05-05 Thread tedd
On Thu, May 4, 2006 10:20 am, James Nunnerley wrote: What I'm not sure about doing is sorting by say Size or Date? There's several different examples of date sorts here: http://www.weberdev.com/AdvancedSearch.php?searchtype=titlesearch=date+sortSubmit1.x=0Submit1.y=0 HTH's tedd --

RE: [PHP] array insights

2006-05-04 Thread Ford, Mike
On 03 May 2006 18:27, Jason Gerfen wrote: I am looking for some information on how to do this the correct way, here is the data I am working with: Array ( [hostname-0] = hostname [mac-0] = 00:0a:b3:aa:00:5d [ip-0] = 192.168.0.1 [subnet] = MMC-Subnet [group] =

[PHP] Array Sorting

2006-05-04 Thread James Nunnerley
Hi All, I've got an array which has the following properties: $file_array[$filename] = array (Date = $Date, size = $size, permissions = $permissions); I can quite happily sort the array by filename (using natksort and natkrsort), which I found on the php manual - and for reference have included

Re: [PHP] Array Sorting

2006-05-04 Thread Stut
James Nunnerley wrote: I've got an array which has the following properties: $file_array[$filename] = array (Date = $Date, size = $size, permissions = $permissions); I can quite happily sort the array by filename (using natksort and natkrsort), which I found on the php manual - and for

RE: [PHP] Array Sorting

2006-05-04 Thread James Nunnerley
don't think so, but would be happy to be corrected! Cheers Nunners -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: 04 May 2006 16:24 To: James Nunnerley Cc: php-general@lists.php.net Subject: Re: [PHP] Array Sorting James Nunnerley wrote: I've got an array which has

Re: [PHP] Array Sorting

2006-05-04 Thread Stut
James Nunnerley wrote: I think I may have written down my variable structure incorrectly in the first place, which even has me confused... The $file_array[$filename] is I don't think a further array. The sub values are created as follows: $file_array[$filename][Date] = ...

Re: [PHP] Array Sorting

2006-05-04 Thread Richard Lynch
On Thu, May 4, 2006 10:20 am, James Nunnerley wrote: $file_array[$filename] = array (Date = $Date, size = $size, permissions = $permissions); I can quite happily sort the array by filename (using natksort and natkrsort), which I found on the php manual - and for reference have included as a

Re: [PHP] Array Sorting

2006-05-04 Thread Richard Lynch
On Thu, May 4, 2006 10:47 am, Stut wrote: It's worth noting that if you're not using the fact that they're indexed on the filename it's probably faster to use integer keys instead of strings, but don't quote me on that. I'm not overly familiar with the internals of PHP... yet! I think this

[PHP] array insights

2006-05-03 Thread Jason Gerfen
I am looking for some information on how to do this the correct way, here is the data I am working with: Array ( [hostname-0] = hostname [mac-0] = 00:0a:b3:aa:00:5d [ip-0] = 192.168.0.1 [subnet] = MMC-Subnet [group] = MMC-PXE [hostname-1] = tester01 [mac-1] =

Re: [PHP] array insights

2006-05-03 Thread Dave Goodchild
use: $new_array = array_chunk($input_array, 3)); this will split your original array into a number of arrays with three elements in each and trash the original keys. If you want to preserve the keys pass a third paramater (true). Hope this helps. On 03/05/06, Jason Gerfen [EMAIL PROTECTED]

Re: [PHP] array insights

2006-05-03 Thread Robert Cummings
On Wed, 2006-05-03 at 13:27, Jason Gerfen wrote: I am looking for some information on how to do this the correct way, here is the data I am working with: Array ( [hostname-0] = hostname [mac-0] = 00:0a:b3:aa:00:5d [ip-0] = 192.168.0.1 [subnet] = MMC-Subnet [group] =

<    1   2   3   4   5   6   7   8   9   10   >