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?
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,
! [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
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
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:
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
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
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
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
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
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
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.
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
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
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,
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
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
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
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.
[EMAIL PROTECTED] wrote:
$count=count($data-legs-leg);
$k=0;
while($k $count)
{
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[$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
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
-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
, 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
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
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
: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
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
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
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
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
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) {
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) {
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
- 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
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
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 =
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
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
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 =
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
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:
- 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
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
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
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
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 )
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
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,
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,
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
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
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:
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
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
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
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 =
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)
# [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
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;
# [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 (;
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
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
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
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
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
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:
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
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
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;
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
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
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) {
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
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
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
$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]
$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
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']);
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
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?
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
-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
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
--
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] =
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
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
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
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] = ...
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
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
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] =
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]
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] =
301 - 400 of 1246 matches
Mail list logo