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]=
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
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
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
- 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
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 =
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
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.
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
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) ?
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
: 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
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
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
, 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
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
-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
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
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
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
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 =
- 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
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
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
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
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
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,
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
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,
, 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
.
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
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
, 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
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 (, ,
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
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
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
[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
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
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,
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
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', ' ***', '
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
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]',
44 matches
Mail list logo