For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > September 2004 > multidimentional arrays in mysql using php









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author multidimentional arrays in mysql using php
Christian Fitzgibbon

2004-09-24, 4:00 pm

Xref: number1.nntp.dca.giganews.com alt.php.sql:21309

Hi,

I have a lead database with a table named LEADS:-

+-----------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+----------------+
| leadid | int(10) unsigned | | PRI | NULL | auto_increment |
| suppcode | varchar(40) | | MUL | | |
| area | varchar(20) | | | | |
| type | varchar(20) | | MUL | | |
| fieldlist | longtext | | | | |
| fielddata | longtext | | | | |
| sentflag | char(1) | YES | | NULL | |
+-----------+------------------+------+-----+---------+----------------+
(sorry about display)

I am putting a multidimentional array into fieldlist & fielddata. The
following is an example record:-

+--------+--------------+------+------+-----------+-----------+----------+
| leadid | suppcode | area | type | fieldlist | fielddata | sentflag |
+--------+--------------+------+------+-----------+-----------+----------+
| 109 | supplier1 | 1 | 1 | Array | Array | N
|
+--------+--------------+------+------+-----------+-----------+----------+
(again sorry about the display)

When I try to read the columns fieldlist & fielddata back into php to work
with, I just get an 'A' as the value in the column.
I am using
$noofvariables=count($record['fieldlist'
]);
as an example, and I always get 1 value returned and that value equals A

What I really want to do is count the number of values in each array and
then extract each array value. I've got the for loop sorted, but counting
the number of values in the array always returns 1, and the value is always
A.

Hope someone can help.

Christian


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com