473,395 Members | 1,595 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,395 software developers and data experts.

Fetching a row in a array where the column number is unknown

Hi thescripts team,

I am trying to retrive a array and display its contents in the page. However, this array will be dynamic, meaning it will have different sizes in each call (there is a function that will handle the display). My question is, how would I make php read the array where it doesnt need to know the number of columns it has? Any technique that I can implement?

Here's a part of the code that I am currently working on.

Expand|Select|Wrap|Line Numbers
  1. foreach ($rowarray as $row)
  2. {
  3.    echo $row[0];
  4.    echo $row[1];
  5.    echo $row[2];
  6. }
Thanks for your replies as always!
Jul 27 '07 #1
3 1080
After posting this thread, I found out my answer. (through experiments).

Expand|Select|Wrap|Line Numbers
  1. foreach ($rowarray as $row)
  2. {
  3.     for($i=0;$i<count($row);$i++)
  4.     {
  5.         echo $row[$i]." ";
  6.     }
  7. }

Whew!
Jul 27 '07 #2
pbmods
5,821 Expert 4TB
Heya, twinklyblue.

Check out mysql_fetch_assoc().
Jul 27 '07 #3
hi pbmods,

thanks for your reply.. however, I am working with Postgres :) I am sure there is a corresponding equivalent for this function.. I can start from this. thanks
Aug 2 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tommie Nygren | last post by:
For different reasons I am reading an array of bytes from a file in my ..jar-file and from this I want to create a PNG image using Image.createImage(myArray, 0 , myArray.length). I had a...
2
by: Rich | last post by:
What my script does right now is : creates a multi-dimensional array, populates the array with values entered by the user. And then it Displays the result on an HTML page in a tabular format...
11
by: truckaxle | last post by:
I am trying to pass a slice from a larger 2-dimensional array to a function that will work on a smaller region of the array space. The code below is a distillation of what I am trying to...
3
by: Eric Lilja | last post by:
Assignment: Create a 3x4 2-dimensional array of integers. Populate each element using some non-random scheme so that no two elemens contain the same value. Then create two functions for printing...
7
by: Mark | last post by:
let's say i have a table in my database, with only one column. all i want to do is retrieve a list of the entries.. i could do it like this $result = mysql_query("SELECT * FROM t1"); while( $x =...
22
by: Sandman | last post by:
So, I have this content management system I've developed myself. The system has a solid community part where members can register and then participate in forums, write weblogs and a ton of other...
5
by: Bhavesh | last post by:
Hello genious people, I m trying to insert a LARGE text from Multiline Textbox into my table of sqlserver2000. I m using vs-2005. Please note that I dont want to store blob data From FILE...
4
by: drktmplr11 | last post by:
Hi, this is my first post here at the forums, and I am looking for assistance with what looks to be a syntax error within my code. I am attending FIU, and looking to broaden my understanding of...
2
by: yeshello54 | last post by:
so here is my problem...in a contact manager i am trying to complete i have ran into an error..we have lots of code because we have some from class which we can use...anyways i keep getting an error...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.