[PHP] Array assignment references: strange behavior

2005-06-30 Thread Nenad Jovanovic
Hi! Under PHP 4.3.10, the following simple code behaves as expected: $b[1] and $c are not modified by the final assignment to $a[1]: Code 1: $a[1] = 1; $b[1] = 2; $c = 3; $a = $b; $a[1] = 7; // resulting mappings: // $a[1] ... 7 // $b[2] ... 2 // $c .. 3 However, the

[PHP] array, trouble updating

2005-05-17 Thread mayo
I usually work with cold fusion and took on a little project to get my feet wet in php and am spinning my wheels. What I thought might be difficult was easy and what I thought would be a piece of cake has caused me much grief over the last few days. I'm making a little shopping basket, writing

Re: [PHP] array, trouble updating

2005-05-17 Thread Jason Wong
On Tuesday 17 May 2005 21:18, mayo wrote: I usually work with cold fusion and took on a little project to get my feet wet in php and am spinning my wheels. What I thought might be difficult was easy and what I thought would be a piece of cake has caused me much grief over the last few days.

RE: [PHP] array, trouble updating

2005-05-17 Thread mayo
Wong [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 17, 2005 5:56 PM To: php-general@lists.php.net Subject: Re: [PHP] array, trouble updating On Tuesday 17 May 2005 21:18, mayo wrote: I usually work with cold fusion and took on a little project to get my feet wet in php and am spinning my wheels

RE: [PHP] array, trouble updating - SOLVED

2005-05-17 Thread mayo
Yikes, Who would have thought something so easy would be such a pain in the butt. I solved it with embedded if-else clauses. Thx all -Original Message- From: mayo [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 17, 2005 9:19 AM To: 'php' Subject: [PHP] array, trouble updating I

Re: [PHP] array diff with both values returned

2005-05-08 Thread Richard Lynch
On Fri, May 6, 2005 7:03 am, blackwater dev said: Hello, Is there a good way to get the difference in two arrays and have both values returned? I know I can use array_dif to see what is in one and not the other but...I need it to work a bit differently. I believe you want array_union

[PHP] Array of objects

2005-05-06 Thread Thomas Hochstetter
Hi there, I need help with arrays. What I want to do is to have an array of the following structure: $mod=array( name=new NameObject()); Then later in the page I want to go $Site = $mod[$_GET[module]] (or something like that) to instantiate a new object.

Re: [PHP] Array of objects

2005-05-06 Thread Jochem Maas
Thomas Hochstetter wrote: Spiraleye.Studios Hi there, I need help with arrays. What I want to do is to have an array of the following structure: $mod=array( name=new NameObject()); ^ -- looks like your single quotes got mangled in my email client. class Test { function Test($str

Re: [PHP] Array of objects

2005-05-06 Thread Jochem Maas
-general@lists.php.net Subject: Re: [PHP] Array of objects Thomas Hochstetter wrote: Spiraleye.Studios Hi there, I need help with arrays. What I want to do is to have an array of the following structure: $mod=array( 'name'=new NameObject()); ^ -- looks like your single quotes got

RE: [PHP] Array of objects

2005-05-06 Thread Thomas Hochstetter
Thanks, will do ;-) (as of this mail) -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: 06 May 2005 03:08 PM To: Thomas Hochstetter Cc: [php] PHP General List Subject: Re: [PHP] Array of objects Thomas Hochstetter wrote: Hi Jochem, Thanks for that. The eval story

[PHP] array diff with both values returned

2005-05-06 Thread blackwater dev
Hello, Is there a good way to get the difference in two arrays and have both values returned? I know I can use array_dif to see what is in one and not the other but...I need it to work a bit differently. I have: $array1=array(name=fred,gender=m,phone==555-);

Re: [PHP] array diff with both values returned

2005-05-06 Thread Philip Hallstrom
Is there a good way to get the difference in two arrays and have both values returned? I know I can use array_dif to see what is in one and not the other but...I need it to work a bit differently. I have: $array1=array(name=fred,gender=m,phone==555-);

Re: [PHP] array from folder

2005-04-26 Thread Petar Nedyalkov
On Monday 25 April 2005 20:24, Ed Dorsch wrote: Can PHP generate an array based on file names in a folder? For example, if I have a folder called photos that includes three files -- tree.jpg, house.jpg and boat.jpg -- can PHP look at the file and generate a variable $photos= array (tree,

Re: [PHP] array from folder

2005-04-26 Thread Mark Sargent
Ed Dorsch wrote: Can PHP generate an array based on file names in a folder? For example, if I have a folder called photos that includes three files -- tree.jpg, house.jpg and boat.jpg -- can PHP look at the file and generate a variable $photos= array (tree, house,boat). Any ideas for how to

Re: [PHP] array from folder

2005-04-26 Thread Mark Sargent
Mark Sargent wrote: Ed Dorsch wrote: Can PHP generate an array based on file names in a folder? For example, if I have a folder called photos that includes three files -- tree.jpg, house.jpg and boat.jpg -- can PHP look at the file and generate a variable $photos= array (tree, house,boat).

[PHP] array from folder

2005-04-25 Thread Ed Dorsch
Can PHP generate an array based on file names in a folder? For example, if I have a folder called "photos" that includes three files -- tree.jpg, house.jpg and boat.jpg -- can PHP "look" at the file and generate a variable $photos= array("tree", "house","boat"). Any ideas for how to

RE: [PHP] array from folder

2005-04-25 Thread Jay Blanchard
[snip] Can PHP generate an array based on file names in a folder? For example, if I have a folder called photos that includes three files -- tree.jpg, house.jpg and boat.jpg -- can PHP look at the file and generate a variable $photos= array (tree, house,boat). Any ideas for how to sniff out a

Re: [PHP] array from folder

2005-04-25 Thread Jason Barnett
Jay Blanchard wrote: [snip] Can PHP generate an array based on file names in a folder? For example, if I have a folder called photos that includes three files -- tree.jpg, house.jpg and boat.jpg -- can PHP look at the file and generate a variable $photos= array (tree, house,boat). Any ideas

Re: [PHP] array from folder

2005-04-25 Thread Kim Briggs
I have a sloppy, insecure script that does this posted on the web, which I use at home to make pages for my personal homepage: http://kimbriggs.com/computers/computer-software/create-html-table.txt You seem to be passing variables programmatically. This is how I use it

Re: [PHP] array from folder

2005-04-25 Thread Richard Lynch
On Mon, April 25, 2005 10:54 am, Jason Barnett said: Jay Blanchard wrote: [snip] Can PHP generate an array based on file names in a folder? For example, if I have a folder called photos that includes three files -- tree.jpg, house.jpg and boat.jpg -- can PHP look at the file and generate a

[PHP] array sorting

2005-03-27 Thread Merlin
Hi there, I would like to save some db power by putting values into a file which are often used. They basicly populate a select field. So I placed those values into associative arrays: $code[language] = array(1= php, 2= asp); Now I would like to sort those for displaying after my preference, not

Re: [PHP] Array problem

2005-03-26 Thread [EMAIL PROTECTED]
May be this help you: $data=$_POST['position']; $positions=array_keys($data); foreach($positions as $pos){ $row=$data[$pos]; foreach($row as $value){ $sql=INSERT INTO table_name (field_name)VALUES ('$value'); $cursor=mysql_query($sql); } } Devta. [EMAIL PROTECTED] escribió:

[PHP] Array problem

2005-03-25 Thread virtualsoftware
Hi, I have a form like this: form action=products.php method=post input name=position[pos][value 1] type=text id=position[pos][value 1] value=number 1 input name=position[pos][value 2] type=text id=position[pos][value 2] value=number 2 input name=position[pos][value 3] type=text

Re: [PHP] Array Help

2005-03-15 Thread Richard Lynch
I'm running into the problem of not having a server that gives me database access or ability to use files to store my data ... Yeah, I know, it sucks. If switching servers isn't an option, just pay for another one somewhere, and then re-direct or something. The time you save HAS to be worth

[PHP] Array Help

2005-03-14 Thread Phil Neeb
Greets, I'm running into the problem of not having a server that gives me database access or ability to use files to store my data ... Yeah, I know, it sucks. Anyway ... My page has a number of profiles about people involved with my organization and all the profiles load into a set appearance.

Re: [PHP] Array Help

2005-03-14 Thread Robert Cummings
On Mon, 2005-03-14 at 18:07, Phil Neeb wrote: Greets, I'm running into the problem of not having a server that gives me database access or ability to use files to store my data ... Yeah, I know, it sucks. Anyway ... My page has a number of profiles about people involved with my

[PHP] 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

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 direction on

[PHP] array search

2005-01-23 Thread Malcolm
Hello All, I've been trying for days now to make this work. I'm trying to search my array for a value and return the key. I get the visitor's IP and try this -- this is the latest, I've tried a few functions to echo the name associated with the viz_ip. $viz_ip= $_SERVER['REMOTE_ADDR'];

Re: [PHP] array search

2005-01-23 Thread Jochem Maas
Malcolm wrote: Hello All, I've been trying for days now to make this work. I'm trying to search my array for a value and return the key. I get the visitor's IP and try this -- this is the latest, I've tried a few functions to echo the name associated with the viz_ip. $viz_ip=

Re: [PHP] array search

2005-01-23 Thread john
I've been trying for days now to make this work. This worked for me (with my IP address for 'John'): ?php $viz_ip= $_SERVER['REMOTE_ADDR']; echo (Your IP is $viz_ip); $byte_ip= array( 204.126.202.56=Mark, 63.230.76.166=Bob, 84.196.101.86=John, ); function _array_search

Re: [PHP] array search

2005-01-23 Thread Malcolm
Thank you Sirs, I was echoing the viz-ip so I know it was getting set but I couldn't get it. both work .. I got the clue from John, the last echo line did the trick. On Sun, 23 Jan 2005 17:26:58 +0100, Jochem Maas [EMAIL PROTECTED] wrote: Malcolm wrote: Hello All, I've been trying

Re: [PHP] array search

2005-01-23 Thread Ben Edwards
probably missing something but php have a function called array_search. Ben On Sun, 23 Jan 2005 11:33:16 -0500 (EST), [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I've been trying for days now to make this work. This worked for me (with my IP address for 'John'): ?php $viz_ip=

[PHP] array problem

2005-01-21 Thread Ahmed Abdel-Aliem
hi if i have an array $listing1 = array(array('title'='yahoo', 'redirect'='www.yahoo.com', 'info'='yahoo website'), array(title='msn', 'redirect'='www.msn.com', 'info='msn website')); $listing2 = array(array('name'='lycos', 'link'='www.lycos.com', 'description'='lycos website'),

Re: [PHP] array problem

2005-01-21 Thread Richard Lynch
Ahmed Abdel-Aliem wrote: how can i group them together into one array to be : http://php.net/array_merge and friends should help -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] array walk and class member functions

2005-01-12 Thread Tom
Hi I'm batting my head against a wall on this one... I have a class that has a constructor which sets some initial conditions, and then a public function that does some work. I want to be able to call this function from an external array_walk call, but when I try and reference it as

Re: [PHP] array walk and class member functions

2005-01-12 Thread Jochem Maas
Tom wrote: Hi I'm batting my head against a wall on this one... I have a class that has a constructor which sets some initial conditions, and then a public function that does some work. I want to be able to call this function from an external array_walk call, but when I try and reference it as

Re: [PHP] array walk and class member functions

2005-01-12 Thread Jochem Maas
Jochem Maas wrote: Tom wrote: snip Sorry Tom, I hit the send button too early! I mean to add some context to the code below so you would (hopefully) understand what I mean: OR define the function outside of the class e.g. function aFunction($value, $key) { global $aReturnString;

Re: [PHP] array walk and class member functions

2005-01-12 Thread Jochem Maas
Tom wrote: Thanks very much for the help - both methods work fine. I'd had a look at the array_walk manual, but didn't realise that the second param would accept an array - that's really cool indeed that page does not make it very clear, it's the generic call_back syntax, which can be used

Re: [PHP] array walk and class member functions

2005-01-12 Thread Jason Barnett
indeed that page does not make it very clear, it's the generic call_back syntax, which can be used practically everywhere a callback function is expected, the array you pass can be in the form of: array($object, 'methodname') or array('classname', 'methodname') the second version allows you to

Re: [PHP] array walk and class member functions

2005-01-12 Thread Tom
Thanks very much for the help - both methods work fine. I'd had a look at the array_walk manual, but didn't realise that the second param would accept an array - that's really cool! I don't like the function_exists method much, as I frequently overload class members. Not needed now as I have

Re: [PHP] array walk and class member functions

2005-01-12 Thread Jochem Maas
Jason Barnett wrote: indeed that page does not make it very clear, it's the generic call_back syntax, which can be used practically everywhere a callback function is expected, the array you pass can be in the form of: array($object, 'methodname') or array('classname', 'methodname') the second

[PHP] Array unset

2004-11-16 Thread Bruno B B Magalhães
Hi, I my system can handle invisible modules, so they can't show in the menu but stills works... here is the code: $c = count($modules)-1; for($i = 0; $i = $c; $i++) { if($modules[$i]['moduleVisibility'] == 0) {

[PHP] Array from database table

2004-11-14 Thread Richard
How do I get the data from a mysql database into and array that looks like this Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] = 5 [5] = 6 ) The table has three fields but I only need the data from one field. $query=SELECT amenityID FROM property_amenity where listingId = '$listingId'; -- PHP

Re: [PHP] Array from database table

2004-11-14 Thread raditha dissanayake
Richard wrote: How do I get the data from a mysql database into and array that looks like this Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] = 5 [5] = 6 ) by using mysql_fetch_row() or mysql_fetch_array() The table has three fields but I only need the data from one field. $query=SELECT amenityID

Re: [PHP] Array to $_GET variable

2004-11-12 Thread Curt Zirzow
* Thus wrote Mike Smith: I am trying to cache a database recordset so users can sort, etc without hitting the database everytime. I'm using ADODB to access a MSSQL database. I wouldn't even bother with this. No matter what you do your going to have to retreive the data somewhere, aka

[PHP] Array to $_GET variable

2004-11-10 Thread Mike Smith
I am trying to cache a database recordset so users can sort, etc without hitting the database everytime. I'm using ADODB to access a MSSQL database. $s = SELECT id, part, description FROM parts\n; $r = $db-Execute($s); $parts = array(id=array(),part=array(),desc=array()) while(!$r-EOF){

Re: [PHP] Array to $_GET variable

2004-11-10 Thread Marek Kilimajer
Mike Smith wrote: I am trying to cache a database recordset so users can sort, etc without hitting the database everytime. I'm using ADODB to access a MSSQL database. $s = SELECT id, part, description FROM parts\n; $r = $db-Execute($s); $parts = array(id=array(),part=array(),desc=array())

RE: [PHP] Array to $_GET variable

2004-11-10 Thread Zareef Ahmed
way to manage this as sometime value may be too long to store in $_GET variable. Do You get any error on unserialization? Zareef ahmed -Original Message- From: Mike Smith [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 10, 2004 10:14 PM To: [EMAIL PROTECTED] Subject: [PHP] Array

[PHP] Array help

2004-11-02 Thread Ryan A
Hi, I have an variable that contains an array like this: [0] = Array( [0] = Array([0] = {3 3}) [1] = Array([0] = 3) ) [1] = Array( [0] = Array([0] = {3 3}) [1] = Array([0] = 3) ) [2] = Array( [0] = Array(

RE: [PHP] Array help

2004-11-02 Thread Jay Blanchard
[snip] [2] = Array( [0] = Array( [0] = {textlinks 0_15} [1] = {textlinks 16_30} ) [1] = Array( [0] = 0_15 [1] = 16_30 ) ) As you can see

[PHP] 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.BR; $OrderObject =$this-orders[$OrderID=$value]; echo $OrderObject-OrderID.--all the sameBR; } I know that $this-orders is an array of order objects. the result i get

[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] 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 plain wrong. It

[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

[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/footer.php

[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

[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

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-orders as $OrderID = $value) { echo $OrderID.BR; I

[PHP] Array concatenation behaviour change

2004-10-08 Thread rich gray
Just a heads up on this change in array concatenation behaviour that could cause a few probs for some people... ? $arr1 = array(0 = 'Zero'); $arr2 = array(1 = 'One',2 = 'Two'); $arr2 = $arr1 + $arr2; echo phpversion().'br /'; print_r($arr2); ? this code produces on our provider's server...

Re: [PHP] Array concatenation behaviour change

2004-10-08 Thread Gareth Williams
Can't you sort the array? On 8 Oct 2004, at 10:41, rich gray wrote: Just a heads up on this change in array concatenation behaviour that could cause a few probs for some people... ? $arr1 = array(0 = 'Zero'); $arr2 = array(1 = 'One',2 = 'Two'); $arr2 = $arr1 + $arr2; echo phpversion().'br /';

Re: [PHP] Array concatenation behaviour change

2004-10-08 Thread rich gray
Can't you sort the array? Yes of course but that wasn't the point of my post I was trying to show that the same code produces differing results on 2 different versions of PHP ... rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] array sort question

2004-10-02 Thread Jasper Howard
On Fri, 1 Oct 2004 22:44:50 -0400, Paul Bissex [EMAIL PROTECTED] wrote: On Fri, 1 Oct 2004 19:12:30 -0700, Ed Lazor [EMAIL PROTECTED] wrote: Any ideas on how I could sort this array by Title? $menu[1][ID] = 5; $menu[1][Title] = Test 1; $menu[2][ID] = 3; $menu[2][Title] = Test 4;

Re: [PHP] array sort question

2004-10-02 Thread Jasper Howard
Sorry for the empty reply (miss slide of the finger on my touch pad). You can use array_multisort(); The code would look something like this, remember, this is untested code so be warned before any flaming is done: //CODE //You need to restructure your array like this: $menu[ID][1] = 5;

RE: [PHP] array sort question

2004-10-02 Thread Ed Lazor
Thanks for the example using array_multisort. I'd been wondering how I could use that function to do what I want. It looks like it's more flexible in the long run, but I was able to use Paul's recommendation to do what I want. Here's the code I ended up using: function cmp ($a, $b) {

[PHP] array sort question

2004-10-01 Thread Ed Lazor
Any ideas on how I could sort this array by Title? $menu[1][ID] = 5; $menu[1][Title] = Test 1; $menu[2][ID] = 3; $menu[2][Title] = Test 4; $menu[3][ID] = 56; $menu[3][Title] = Test 8; $menu[4][ID] = 44; $menu[4][Title] = Test 3; Thanks, -Ed

Re: [PHP] array sort question

2004-10-01 Thread Paul Bissex
On Fri, 1 Oct 2004 19:12:30 -0700, Ed Lazor [EMAIL PROTECTED] wrote: Any ideas on how I could sort this array by Title? $menu[1][ID] = 5; $menu[1][Title] = Test 1; $menu[2][ID] = 3; $menu[2][Title] = Test 4; uasort() is what you need here. Also see the usort() documentation page

[PHP] Array inside Class

2004-09-10 Thread dirk
Hello everybody, can anyone explain to me, why I can't resize an array inside a class? Sample Code: ?php class Liste { var $input = array (1,2,3); var $input2 = array_pad ($input,10, 1); } ? Output: Parse error: parse error, unexpected '(', expecting ',' or ';' in

Re: [PHP] Array inside Class

2004-09-10 Thread Greg Donald
On Fri, 10 Sep 2004 20:09:55 +0200, dirk [EMAIL PROTECTED] wrote: can anyone explain to me, why I can't resize an array inside a class? Sample Code: ?php class Liste { var $input = array (1,2,3); var $input2 = array_pad ($input,10, 1); } ? Output: Parse error: parse error,

Re: [PHP] Array inside Class

2004-09-10 Thread Chris Dowell
From the manual: In PHP 4, only constant initializers for var variables are allowed. To initialize variables with non-constant values, you need an initialization function which is called automatically when an object is being constructed from the class. Such a function is called a constructor

Re: [PHP] Array inside Class

2004-09-10 Thread John Holmes
From: dirk [EMAIL PROTECTED] can anyone explain to me, why I can't resize an array inside a class? Sample Code: ?php class Liste { var $input = array (1,2,3); var $input2 = array_pad ($input,10, 1); } ? Output: Parse error: parse error, unexpected '(', expecting ',' or ';' in

Re: [PHP] Array inside Class

2004-09-10 Thread dirk
Well, doesn't work either: Parse error: parse error, unexpected T_VARIABLE, expecting T_FUNCTION in /srv/www/htdocs/stundenplan/stpoo.php on line 5 I forgot to mention that I'm using php-5.0.1 before Dirk On Fri, 10 Sep 2004 14:26:22 -0400, John Holmes [EMAIL PROTECTED] wrote: From: dirk

Re: [PHP] Array inside Class

2004-09-10 Thread John Holmes
From: dirk [EMAIL PROTECTED] Try this: var $input = array(1,2,3); var $input2 = array(); $this-input2 = array_pad($this-input,10,1); Well, doesn't work either: Parse error: parse error, unexpected T_VARIABLE, expecting T_FUNCTION in /srv/www/htdocs/stundenplan/stpoo.php on line 5 The array_pad

Re: [PHP] Array inside Class

2004-09-10 Thread dirk
Works fine within the constructor, thanks. Dirk On Fri, 10 Sep 2004 14:38:45 -0400, John Holmes [EMAIL PROTECTED] wrote: From: dirk [EMAIL PROTECTED] Try this: var $input = array(1,2,3); var $input2 = array(); $this-input2 = array_pad($this-input,10,1); Well, doesn't work either:

Re: [PHP] Array inside Class

2004-09-10 Thread Wouter van Vliet
On Fri, 10 Sep 2004 14:26:22 -0400, John Holmes [EMAIL PROTECTED] wrote: From: dirk [EMAIL PROTECTED] can anyone explain to me, why I can't resize an array inside a class? Sample Code: ?php class Liste { var $input = array (1,2,3); var $input2 = array_pad ($input,10, 1); } ?

Re: [PHP] Array inside Class

2004-09-10 Thread M. Sokolewicz
Wouter Van Vliet wrote: On Fri, 10 Sep 2004 14:26:22 -0400, John Holmes [EMAIL PROTECTED] wrote: From: dirk [EMAIL PROTECTED] can anyone explain to me, why I can't resize an array inside a class? Sample Code: ?php class Liste { var $input = array (1,2,3); var $input2 = array_pad ($input,10, 1);

Re: [PHP] Array inside Class

2004-09-10 Thread Greg Beaver
M. Sokolewicz wrote: To summarize: ?php class Liste { var $input2; var $input; function Liste() { /* or, if you're using php5: public function __construct() { */ $this-input = array(1,2,3); $this-input2 = array_pad($this-input,10,1); } } The reason being, for this, that

RE: [PHP] array

2004-09-08 Thread Jay Blanchard
[snip] I'm reading data. Can I open a connection within a connection and write data to another $db.$table or do I have to write my data to an array. In an array, how do I do this? I've looked at array_push, but don't think this is what I want? $authors = array();

[PHP] array

2004-09-07 Thread John Taylor-Johnston
I'm reading data. Can I open a connection within a connection and write data to another $db.$table or do I have to write my data to an array. In an array, how do I do this? I've looked at array_push, but don't think this is what I want? $authors = array();

[PHP] Array?

2004-08-25 Thread Nathan Mealey
I cannot seem to access elements inside of the array $things in the code below. All of the errors say Undefined offset: 7 in /Library/WebServer/Documents/lis/check.php on line 26 I don't see why... The code is: $q = select * from users where email='.$email.' and password='.$pass.';

Re: [PHP] Array?

2004-08-25 Thread John Holmes
From: Nathan Mealey [EMAIL PROTECTED] I cannot seem to access elements inside of the array $things in the code below. All of the errors say Undefined offset: 7 in /Library/WebServer/Documents/lis/check.php on line 26 I don't see why... The code is: $q = select * from users where

Re: [PHP] Array?

2004-08-25 Thread Jason Wong
On Thursday 26 August 2004 02:17, Nathan Mealey wrote: I cannot seem to access elements inside of the array $things in the code below. All of the errors say Undefined offset: 7 in /Library/WebServer/Documents/lis/check.php on line 26 I don't see why... The code is: $q = select *

Re: [PHP] Array?

2004-08-25 Thread Craig Brothers
how many elements are returned by the sql statement? If you want the 7th item returned in the sql statement would need to code $things[6] Just a hunch... -- Craig Brothers @utoRevenue [EMAIL PROTECTED] (413) 528-8000 x105 On Wed, 2004-08-25 at 14:17, Nathan Mealey wrote: I cannot seem to

Re: [PHP] Array?

2004-08-25 Thread Robert Cummings
On Wed, 2004-08-25 at 14:17, Nathan Mealey wrote: I cannot seem to access elements inside of the array $things in the code below. All of the errors say Undefined offset: 7 in /Library/WebServer/Documents/lis/check.php on line 26 I don't see why... The code is: $q =

Re: [PHP] Array?

2004-08-25 Thread Michal Migurski
I cannot seem to access elements inside of the array $things in the code below. All of the errors say Undefined offset: 7 in /Library/WebServer/Documents/lis/check.php on line 26 I don't see why... print_r is your bestest buddy. $results = mysql_query($q); if ($results) {

[PHP] Array assistance

2004-07-27 Thread Alex Hogan
Hi All, I have a page where I'm collecting answers from a series of questions. The questions are entered into the array one at a time so I can keep track of paging. $arans = array($_POST); $_SESSION['arans'][$pageid] = $arans; Then I want to check the sum of the array for scoring

Re: [PHP] Array assistance

2004-07-27 Thread Jason Davidson
I would simply build the array more specifically, so that it doesnt include things you dont want. Jason On Tue, 27 Jul 2004 16:20:02 -0500, Alex Hogan [EMAIL PROTECTED] wrote: Hi All, I have a page where I'm collecting answers from a series of questions. The questions are entered into the

Re: [PHP] Array assistance

2004-07-27 Thread Matt M.
Ten separate arrays with an array at 0 that has the data I'm after. This is where I'm getting stuck. How can I get to the keys that are either 'mc' or 'truefalse' and sum them? foreach my man http://us2.php.net/foreach foreach ($_SESSION['arans'] as $arans) { $truefalse +=

[PHP] Array help

2004-07-23 Thread Robb Kerr
I've got a field in my database that contains a single numerical character (1 or 2 or 3, etc.). I need to load a different background image in one cell of a table depending upon what the number the field contains. What's the easy syntax for associating entries in the field (1 or 2 or 3, etc.) with

Re: [PHP] Array help

2004-07-23 Thread Matt M.
I've got a field in my database that contains a single numerical character (1 or 2 or 3, etc.). I need to load a different background image in one cell of a table depending upon what the number the field contains. What's the easy syntax for associating entries in the field (1 or 2 or 3, etc.)

Re: [PHP] Array help

2004-07-23 Thread Jason Davidson
You can either hard code the associations, with something like a swtich statement, or i suppose loop thru one array, adding a key value pair of the numbers = background images. Or, you could create a table called Backgrounds, give them an id which you store in the existing field of your db, and

Re: [PHP] Array help

2004-07-23 Thread Matthew Sims
I've got a field in my database that contains a single numerical character (1 or 2 or 3, etc.). I need to load a different background image in one cell of a table depending upon what the number the field contains. What's the easy syntax for associating entries in the field (1 or 2 or 3,

Re: [PHP] Array help

2004-07-23 Thread Robb Kerr
On Fri, 23 Jul 2004 14:21:42 -0700 (PDT), Matthew Sims wrote: imgBkgrnd = array(1= bkgrnd-default.gif, 2 = bkgrnd-positive.gif, 3 = bkgrnd-negative.gif); You got it... imgBkgrnd = array(1= bkgrnd-default.gif, 2 = bkgrnd-positive.gif, 3 = bkgrnd-negative.gif); imgNeeded = table['field'];

RE: [PHP] Array help

2004-07-23 Thread Pablo Gosse
Robb Kerr wrote: On Fri, 23 Jul 2004 14:21:42 -0700 (PDT), Matthew Sims wrote: imgBkgrnd = array(1= bkgrnd-default.gif, 2 = bkgrnd-positive.gif, 3 = bkgrnd-negative.gif); You got it... imgBkgrnd = array(1= bkgrnd-default.gif, 2 = bkgrnd-positive.gif, 3 = bkgrnd-negative.gif); imgNeeded

Re: [PHP] Array help

2004-07-23 Thread Matt M.
imgBkgrnd = array(1= bkgrnd-default.gif, 2 = bkgrnd-positive.gif, 3 = bkgrnd-negative.gif); You got it... imgBkgrnd = array(1= bkgrnd-default.gif, 2 = bkgrnd-positive.gif, 3 = bkgrnd-negative.gif); imgNeeded = table['field']; imgName = ??? http://us3.php.net/array $imgBkgrnd =

Re: [PHP] Array help

2004-07-23 Thread Matthew Sims
imgBkgrnd = array(1= bkgrnd-default.gif, 2 = bkgrnd-positive.gif, 3 = bkgrnd-negative.gif); You got it... imgBkgrnd = array(1= bkgrnd-default.gif, 2 = bkgrnd-positive.gif, 3 = bkgrnd-negative.gif); imgNeeded = table['field']; imgName = ??? http://us3.php.net/array $imgBkgrnd =

[PHP] Array Losing value

2004-07-19 Thread Jonathan Villa
I have a class called DBI which handles all of my database calls. One method called Fetch_Array simply has return mysql_fetch_assoc($resultID) It's losing it's value when I try to pass the val to another var example class BaseItem { function getBaseItems() { return

[PHP] array indexes as arguments to a function

2004-07-12 Thread Dennis Gearon
please CC me, as I am on digest. --- say I've got a class that stores the cookie/get/post vars. I want to retrieve say one of them. Say, that post vars come back from browser as: POST[var1_arr][dim1][dim2] they are stored in

[PHP] Array problem

2004-06-14 Thread Brent Clark
Hi all I have this problem whereby im try to create some kind of an array of a split off a file. //Here I pull the file in the array $contents. $contents = file($hotelpathprod.$hotel); foreach($contents as $arr=$conts){ $ff[] = split(\|,$conts); //Here im trying to

[PHP] Array keys referencing value from another array key???

2004-06-06 Thread Gerard Samuel
Not sure if the subject was worded correctly, but I was looking to see if this (or something like it) is possible. $array = array('key_1' = 'This is some text', 'key_2' = 'b' . $array['key_1'] . '/b' ); And the array structure would be something

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