[PHP] problem with array

2007-07-15 Thread Ross
I am using postcode anywhere for a 'where's my nearest' function. All the geographical info is contained in an array, which when dumped looks like this var_dump ($result); array(1) { [0]= array(13) { [origin_postcode]= string(7) EH2 2BE [destination_postcode]= string(6) EH2 2BE [distance]=

Re: [PHP] problem with array

2007-07-15 Thread Jim Lucas
Ross wrote: I am using postcode anywhere for a 'where's my nearest' function. All the geographical info is contained in an array, which when dumped looks like this var_dump ($result); array(1) { [0]= array(13) { [origin_postcode]= string(7) EH2 2BE [destination_postcode]= string(6) EH2 2BE

[PHP] PHP problem with array keys / pointers

2006-12-17 Thread julian haffegee
Hi all, I've a problem thats been bothering me for a week now I have an array $animals keys and values like this 1 = cat 2 = dog 3 = mouse 4 = horse I want to be able to access them using either a key or a pointer, however the key/pointer will be a variable without variables, if I want

Re: [PHP] PHP problem with array keys / pointers

2006-12-17 Thread Pintér Tibor
1 = cat 2 = dog 3 = mouse 4 = horse iwfm with array(1='cat',2='dog',3='mouse',4='horse'): output: Array ( [1] = cat [2] = dog [3] = mouse [4] = horse ) dog source: ? $animals=array(1='cat',2='dog',3='mouse',4='horse'); print_r($animals); $x=2; echo $animals[$x].\n; ? t -- PHP

Re: [PHP] PHP problem with array keys / pointers

2006-12-17 Thread Satyam
- Original Message - From: julian haffegee [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Sunday, December 17, 2006 7:31 PM Subject: [PHP] PHP problem with array keys / pointers Hi all, I've a problem thats been bothering me for a week now I have an array $animals keys

Re: [PHP] PHP problem with array keys / pointers

2006-12-17 Thread Jochem Maas
don't hijack an existing thread. (i.e. don't reply to someone elses' post/reply if your asking a new question. you need to learn to use var_dump(), and if you look at the line of code below you should have everything you need to know about numeric array keys: $a = array(2 = foo); $b = array(2 =

Re: [PHP] PHP problem with array keys / pointers

2006-12-17 Thread julian haffegee
will set the element of ordinal number 0 and key ' 2' to 'dog'. To get that value you would either ask for $array[0] or $array[' 2']. thanks for all the comments so far, i'm not sure you are understanding what I am asking for. My problem is NOT knowing what is in the arrays, but how to

Re: [PHP] PHP problem with array keys / pointers

2006-12-17 Thread Robert Cummings
On Sun, 2006-12-17 at 23:19 +, julian haffegee wrote: will set the element of ordinal number 0 and key ' 2' to 'dog'. To get that value you would either ask for $array[0] or $array[' 2']. thanks for all the comments so far, i'm not sure you are understanding what I am asking for.

[PHP] Problem with array

2005-06-17 Thread Ross
As with my previous post the problem is the pieces of the array can vary from 1 to 4 items. So pieces 3 and 4 are often undefined giving the 'undefined index' notice. All I really want to do is display the array pieces if they EXIST. But as they are inside a echo statement so I can't even to a

Re: [PHP] Problem with array

2005-06-17 Thread Rory Browne
Not sure if it works for numeric indices, but maybe you could replace $piece[3] with (array_key_exists(3, $piece) ? $piece[3] : ). If you want you could abstract that into a function, like function array_access_element($key, $srch_array, $def=){ return array_key_exists($key, $srch_array) ?

Re: [PHP] Problem with array

2005-06-17 Thread Rick Emery
Quoting Ross [EMAIL PROTECTED]: As with my previous post the problem is the pieces of the array can vary from 1 to 4 items. So pieces 3 and 4 are often undefined giving the 'undefined index' notice. All I really want to do is display the array pieces if they EXIST. But as they are inside a echo

RE: [PHP] Problem with array

2005-06-17 Thread Leila Lappin
: Friday, June 17, 2005 2:30 PM To: php-general@lists.php.net Subject: Re: [PHP] Problem with array Quoting Ross [EMAIL PROTECTED]: As with my previous post the problem is the pieces of the array can vary from 1 to 4 items. So pieces 3 and 4 are often undefined giving the 'undefined index' notice

[PHP] Problem with array

2005-05-01 Thread Murray @ PlanetThoughtful
Hi All, I have 2 function, 1 which calls another, that I am attempting to use in a page with, currently, some problems. In essence, I have a hierarchical recordset table called tbl_content (contid and parid, where parid contains the contid of the record to which the current record

Re: [PHP] Problem with array

2005-05-01 Thread Richard Lynch
On Sun, May 1, 2005 10:21 am, Murray @ PlanetThoughtful said: ? function listProjectChildren($contid, $list=''){ if ($contid''){ $arrtree = array(); $arrtree = buildProjectTree($contid, $level=1); for

RE: [PHP] Problem with array

2005-05-01 Thread Murray @ PlanetThoughtful
, 2 May 2005 5:04 AM To: Murray @ PlanetThoughtful Cc: php-general@lists.php.net Subject: Re: [PHP] Problem with array On Sun, May 1, 2005 10:21 am, Murray @ PlanetThoughtful said: ? [Here there be snippage: please see original post for outline of problem] -- PHP General Mailing List

RE: [PHP] Problem with array

2005-05-01 Thread Richard Lynch
On Sun, May 1, 2005 1:08 pm, Murray @ PlanetThoughtful said: Color me confused. I removed global $arrtree; and added $arrtree = array(); to the function buildProjectTree() and now the parent function (listProjectChildren) returns no values at all. I've checked the page from which

RE: [PHP] Problem with array

2005-05-01 Thread Murray @ PlanetThoughtful
-Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, 2 May 2005 6:16 AM To: Murray @ PlanetThoughtful Cc: php-general@lists.php.net Subject: RE: [PHP] Problem with array On Sun, May 1, 2005 1:08 pm, Murray @ PlanetThoughtful said: Color me confused. I

RE: [PHP] Problem with array

2005-05-01 Thread Richard Lynch
On Sun, May 1, 2005 1:46 pm, Murray @ PlanetThoughtful said: -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, 2 May 2005 6:16 AM To: Murray @ PlanetThoughtful Cc: php-general@lists.php.net Subject: RE: [PHP] Problem with array On Sun, May 1, 2005 1:08

[PHP] problem with array diff, need to reindex array according to key

2005-04-26 Thread Angelo Zanetti
HI all, I am using the array_diff function. The problem im having is the array that gets returned. Well here's an example: this is where i assign the values to two different arrays $a[]=0; $a[]=1; $a[]=2; $a[]=3; $b[]=1; $b[]=4; $b[]=0; $diff = array_diff_assoc($a, $b); then compare the

Re: [PHP] Problem with array

2004-12-15 Thread Jason Wong
On Thursday 16 December 2004 13:33, Ahmed Abdel-Aliem wrote: Put this at the beginning of all your code: error_reporting(E_ALL); ini_set('display_errors', TRUE); Then run your code to see all the errors and warnings and notices that it generates. Then incorporate the changes below: i

[PHP] Problem with array

2004-12-15 Thread Ahmed Abdel-Aliem
Hi i am retrieving records from database and putting each row in a array here is the code @ $db = mysql_connect ($server, $user, $pass); mysql_select_db($database); $query = SELECT Game_ID FROM games WHERE Game_Category='$Game_Category'; $result= mysql_query($query); $total_numbers =

Re: [PHP] problem with array

2004-10-19 Thread Minuk Choi
- Original Message - From: Dale Hersowitz [EMAIL PROTECTED] To: 'Minuk Choi' [EMAIL PROTECTED] Sent: Tuesday, October 19, 2004 12:38 AM Subject: RE: [PHP] problem with array Minuk, After much searching and asking, I found the answer to my problem. It turns out that after re-attaching my

RE: [PHP] problem with array

2004-10-15 Thread Graham Cossey
Hi guys, Recently, I had to reformat one of the web servers and now I have encountered an unusual problem. I am not sure whether this is an issue which can be fixed in the .ini file or whether its specific to the version of php I am using. Here is the problem: $query=SELECT * FROM

[PHP] problem with array

2004-10-14 Thread Dale Hersowitz
Hi guys, Recently, I had to reformat one of the web servers and now I have encountered an unusual problem. I am not sure whether this is an issue which can be fixed in the .ini file or whether its specific to the version of php I am using. Here is the problem: $query=SELECT * FROM

Re: [PHP] problem with array

2004-10-14 Thread Jason Wong
On Friday 15 October 2004 09:58, Dale Hersowitz wrote: For some reason, on the last row, I am not unable to reference a particular index in the array using a php variable. This has been working for almost 12 months and now the coding is breaking all over the place. I don't have an answer. Any

Re: [PHP] problem with array

2004-10-14 Thread Minuk Choi
what would $row[1] return? If this is NOT your question, please post your output(errors and all). - Original Message - From: Dale Hersowitz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 14, 2004 9:58 PM Subject: [PHP] problem with array Hi guys, Recently, I had

[PHP] Problem with array variables in forms

2003-02-18 Thread Chris Pudney
G'day, Our web-host just upgraded to PHP v4.2.3 (from v4.1.2) and broke all of our forms that use array variables. It appears that when the URL contains square brackets (i.e. %5B and %5D instead of [ and ]) then PHP doesn't parse the variables correctly. For example,

Re: [PHP] Problem with array variables in forms

2003-02-18 Thread Chris Pudney
G'day, It appears that when the URL contains square brackets (i.e. %5B and %5D instead of [ and ]) then PHP doesn't parse the variables correctly. For example, http://www.offloadonline.com/test.php?personal[name]=johnpersonal[email]=john%40blah.com works (you might need to paste the URL

[PHP] Problem creating array from MySql query

2003-02-17 Thread Janyne Kizer
What we are trying to do is build an array from a query. I don't understand why but this is failing on the line $affiliations[] = $affiliation_row[affiliation]; Basically there are two tables in the database, since clubs can have multiple affiliations and the affiliations are not set in stone,

Re: [PHP] Problem creating array from MySql query

2003-02-17 Thread Rick Emery
, February 17, 2003 9:04 AM Subject: [PHP] Problem creating array from MySql query What we are trying to do is build an array from a query. I don't understand why but this is failing on the line $affiliations[] = $affiliation_row[affiliation]; Basically there are two tables in the database, since

Re: [PHP] Problem creating array from MySql query

2003-02-17 Thread Janyne Kizer
. For isntance, what does your mysql_query() statement look like? Does it have an or die(mysql_error())) clause? - Original Message - From: Janyne Kizer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 17, 2003 9:04 AM Subject: [PHP] Problem creating array from MySql query

Re: [PHP] Problem creating array from MySql query

2003-02-17 Thread Rick Emery
will forget what you said. People will forget what you did. But people will never forget how you made them feel. - Original Message - From: Janyne Kizer [EMAIL PROTECTED] To: Rick Emery [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 17, 2003 9:31 AM Subject: Re: [PHP] Problem

Re: [PHP] Problem creating array from MySql query

2003-02-17 Thread Janyne Kizer
, 2003 9:04 AM Subject: [PHP] Problem creating array from MySql query What we are trying to do is build an array from a query. I don't understand why but this is failing on the line $affiliations[] = $affiliation_row[affiliation]; Basically there are two tables in the database, since clubs

Re: [PHP] Problem creating array from MySql query

2003-02-17 Thread Rick Emery
feel. - Original Message - From: Janyne Kizer [EMAIL PROTECTED] To: Rick Emery [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 17, 2003 9:31 AM Subject: Re: [PHP] Problem creating array from MySql query Thanks for taking a look at this. ?php mysql_connect (, ,

Re: [PHP] Problem creating array from MySql query

2003-02-17 Thread Janyne Kizer
you did. But people will never forget how you made them feel. - Original Message - From: Janyne Kizer [EMAIL PROTECTED] To: Rick Emery [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 17, 2003 9:31 AM Subject: Re: [PHP] Problem creating array from MySql query Thanks

Re: [PHP] Problem creating array from MySql query

2003-02-17 Thread Rick Emery
17, 2003 9:51 AM Subject: Re: [PHP] Problem creating array from MySql query No error. It just times out. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Problem creating array from MySql query

2003-02-17 Thread Janyne Kizer
will forget what you did. But people will never forget how you made them feel. - Original Message - From: Janyne Kizer [EMAIL PROTECTED] To: Rick Emery [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 17, 2003 9:51 AM Subject: Re: [PHP] Problem creating array from MySql query

Re: [PHP] Problem creating array from MySql query

2003-02-17 Thread Leif K-Brooks
[EMAIL PROTECTED] To: Rick Emery [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 17, 2003 9:51 AM Subject: Re: [PHP] Problem creating array from MySql query No error. It just times out. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt

[PHP] problem with array and session

2002-08-12 Thread Ricky
Hello everybody I'd like to make a page in which the results shown can be bookmarked by clicking a button aside each of them. Actually first it should check if the session is open already ... Then if that item(that comes from a query to a MySQL table) has been registered already, finally it

[PHP] Problem with array

2002-04-30 Thread Carlos Fernando Scheidecker Antunes
Hello All, I've got a form that creates checkboxes based on the number of rows on a table. The user has to check some of the boxes and then click submit. The boxes are named RG1, RG2, RG3, If there are 4 checkboxes and the user selects them all or selects the first, second and fourth,

Re: [PHP] Problem with array

2002-04-30 Thread Richard Emery
show the form. - Original Message - From: Carlos Fernando Scheidecker Antunes [EMAIL PROTECTED] To: PHP-GENERAL [EMAIL PROTECTED] Sent: Tuesday, April 30, 2002 10:11 AM Subject: [PHP] Problem with array Hello All, I've got a form that creates checkboxes based on the number of rows

[PHP] Problem Inserting Array of Rows from form

2001-07-15 Thread David
I am trying to insert an array of rows or values from a PHP form into a MySQL database. There are six columns in the table songs: id, songname, rating, video, album_id, movie. Here is what I get when I submit the form Add songs for Record Array INSERT INTO songs VALUES (' 1, blah', ' ***', '

Re: [PHP] Problem Inserting Array of Rows from form

2001-07-15 Thread Hank Marquardt
For one, as you've written it you have a mismatch of columns vs. fields -- You're combining id and name into one field for the insert -- thus you have five fields trying to be inserted into a table with six elemets. You should have a print of the mysql_error() in your debug code ... I bet if

Re: [PHP] Problem Inserting Array of Rows from form

2001-07-15 Thread David
I did add mysql_error which helped me solve part of the problem: I was missing a single quote in the $val line after $id[$i] and before songname : Here is the corrected code but there is still a problem, $vals .=, ('$id[$i]', '$songname[$i]', '$rating[$i]', '$video[$i]', '$album_id[$i]',