473,404 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

implode() function

I have 2-dimensional array with numeric indices for both dimensions,
called $results, which contains the search results from a database.
The first dimension contains the records, and the second contains the
fields. I want to convert it into an XHTML table to echo to the
browser. For a 1-dimensional array, I would do this with implode().
Can I use implode() on a 2D array? If not, is there some other
function I could use to do this, or will I have to write my own? Or
has anyone already written one?

Jul 17 '05 #1
2 1646
anybody?

Jul 17 '05 #2
On 28 Feb 2005 19:32:25 -0800, "DJ Craig" <sp**@djtricities.com>
wrote:
I have 2-dimensional array with numeric indices for both dimensions,
called $results, which contains the search results from a database.
The first dimension contains the records, and the second contains the
fields. I want to convert it into an XHTML table to echo to the
browser. For a 1-dimensional array, I would do this with implode().
Can I use implode() on a 2D array?
I'm honestly surprised you would use implode() to render a
1-dimensional array in XHTML. That's a rather hackish approach to the
problem.
If not, is there some other
function I could use to do this, or will I have to write my own?


You'll have to write your own, but the problem is pretty trivial.
Just iterate both dimensions of the array and print out what you need.

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Andreas Paasch | last post by:
I'm having trouble with the implode function and need some help here. I've been reading at php.net but that didn't solve my problem. I'm having the below code: $query = "SELECT top1, top2,...
11
by: Jeff | last post by:
Hello. Quick background as I dont wish to hog anyones time. I am a customer of a PHP/SQL programmer. A website that I had the programmer build for me is working great, with one exception. I...
2
by: Bosconian | last post by:
I'm looking for an implode function like the one found in PHP. I could write my own, but am wondering if something already exists.
18
by: NoWhereMan | last post by:
Maybe a stupid question. ------------------------- 1 ------------------------- $str = ''; for($i=0; $i<10; $i++) $str .= $i;
1
by: scatfly | last post by:
I have a set of values that were put into a form and am now using this to put into a database. this is my error: "Warning: implode() : Bad arguments. in /home/xxxxxx/public_html/login.php on line...
4
by: atyndall | last post by:
OK, this is the relevant portion script: <?php $username = '__'; // MySQL Database Username. $password = '__'; // MySQL Database Password. $server = '__'; // MySQL Database server (most...
3
by: BryanA | last post by:
I'm not quite sure which function to use when I want to add a comma to the end of every line and a semi colon to the last one. Because it generates everything on the fly I can't count the rows from...
5
by: pedalpete | last post by:
I've been working on this for hours, and i keep getting the same error. I am trying to grab the content from a file on my own server. The page I request has a variable passed, and it wasn't...
6
by: tokcy | last post by:
Hi, I am having a problem with implode() function in PHP. whenever i am running my code it display an error like. Warning: implode() : Bad arguments. in D:\xampp\htdocs\admin\addspecs.php on...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.