473,396 Members | 2,070 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,396 software developers and data experts.

how to fetch array values

Dear friends,

I am storing values in Array. My array looks like this::


balu 26 MCA gold -------------> first row of array
amar 27 MBA gold -------------> 2nd row of array
raja 28 MSC gold -------------> 3rd row of array


Now i would like to retrieve first row of array and its columns. I have to do in php.thanks in advance.suggestions required.
May 22 '08 #1
5 3209
Markus
6,050 Expert 4TB
Do you have any understanding of PHP?

How is the array built?

do a print_r() on your array and show us the results.
May 22 '08 #2
Do you have any understanding of PHP?

How is the array built?

do a print_r() on your array and show us the results.
Expand|Select|Wrap|Line Numbers
  1. PHP code goes here
  2. while ($row = oci_fetch_array ($stmt1, OCI_BOTH)) 
  3. {
  4.    $tempArray = array('ABC_BANK_ID' => $row['ABC_BANK_ID'],
  5. 'ABC_BANKACCNT_STATUS' => $row['ABC_BANKACCNT_STATUS'],
  6. 'ABC_BANK_BSB' => $row['ABC_BANK_BSB'],
  7. 'ABC_BANK_ACCNAME' => $row['ABC_BANK_ACCNAME'],
  8. 'ABC_BANK_ADDRESS1' => $row['ABC_BANK_ADDRESS1'],
  9. 'ABC_BANK_ADDRESS2' => $row['ABC_BANK_ADDRESS2'],
  10.  'ABC_BANK_SUBURB' => $row['ABC_BANK_SUBURB'],
  11. 'ABC_BANK_ACCNUM' => $row['ABC_BANK_ACCNUM'],
  12. 'ABC_BANK_ACCNAME1' => $row['ABC_BANK_ACCNAME1'],
  13. 'ABC_BANK_ACCTYPE' => $row['ABC_BANK_ACCTYPE'],
  14. 'ABC_STATE_ID' => $row['ABC_STATE_ID'],
  15. 'ABC_BANK_NAME' => $row['ABC_BANK_NAME'],
  16. 'ABC_BANK_SUFFIX' => $row['ABC_BANK_SUFFIX'],
  17. 'ABC_ISO_COUNTRY_NUM_CODE' => $row['ABC_ISO_COUNTRY_NUM_CODE'],
  18. 'ABC_ISO_CURRENCY_NUM_CODE' => $row['ABC_ISO_CURRENCY_NUM_CODE'],
  19. 'ABC_MEMBER_ID' => $row['ABC_MEMBER_ID']
  20. array_push($result, $tempArray);
I am doing Php from last 5 days. plz help me .
May 22 '08 #3
Markus
6,050 Expert 4TB
You access the array using the key.

The key is the first part of the array which is followed by the assignment:

[php]
$arr = array
(
'array_key1' => 'this is the first',
'array_key2' => 'this is the second'
);

// access it by the array keys:
echo $arr['array_key1'];
[/php]
Hope that helps.
May 22 '08 #4
ronverdonk
4,258 Expert 4TB
WARNING:
Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future.

MODERATOR
May 22 '08 #5
Atli
5,058 Expert 4TB
Expand|Select|Wrap|Line Numbers
  1. PHP code goes here
  2. while ($row = oci_fetch_array ($stmt1, OCI_BOTH)) 
  3. {
  4.    $tempArray = array('ABC_BANK_ID' => $row['ABC_BANK_ID'],
  5. 'ABC_BANKACCNT_STATUS' => $row['ABC_BANKACCNT_STATUS'],
  6. 'ABC_BANK_BSB' => $row['ABC_BANK_BSB'],
  7. 'ABC_BANK_ACCNAME' => $row['ABC_BANK_ACCNAME'],
  8. 'ABC_BANK_ADDRESS1' => $row['ABC_BANK_ADDRESS1'],
  9. 'ABC_BANK_ADDRESS2' => $row['ABC_BANK_ADDRESS2'],
  10.  'ABC_BANK_SUBURB' => $row['ABC_BANK_SUBURB'],
  11. 'ABC_BANK_ACCNUM' => $row['ABC_BANK_ACCNUM'],
  12. 'ABC_BANK_ACCNAME1' => $row['ABC_BANK_ACCNAME1'],
  13. 'ABC_BANK_ACCTYPE' => $row['ABC_BANK_ACCTYPE'],
  14. 'ABC_STATE_ID' => $row['ABC_STATE_ID'],
  15. 'ABC_BANK_NAME' => $row['ABC_BANK_NAME'],
  16. 'ABC_BANK_SUFFIX' => $row['ABC_BANK_SUFFIX'],
  17. 'ABC_ISO_COUNTRY_NUM_CODE' => $row['ABC_ISO_COUNTRY_NUM_CODE'],
  18. 'ABC_ISO_CURRENCY_NUM_CODE' => $row['ABC_ISO_CURRENCY_NUM_CODE'],
  19. 'ABC_MEMBER_ID' => $row['ABC_MEMBER_ID']
  20. array_push($result, $tempArray);
I am doing Php from last 5 days. plz help me .
Ok. Looking past the obvious syntax errors..

This is completely redundant.
You are essentially just copying the array, element by element, and then doing nothing with it.

You could just as well do:
Expand|Select|Wrap|Line Numbers
  1. while ($row = oci_fetch_array ($stmt1, OCI_BOTH)) 
  2. {
  3.    $tempArray = $row;
  4. }
  5.  
What are you actually trying to accomplish?
May 22 '08 #6

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

Similar topics

2
by: Jeremy Moncho | last post by:
Hi guys, I am having a comprehension problem for which I cannot seem to find an answer (by banging my head on my keyboard.) I have the following code which yields no results. I expect one...
1
by: Ann | last post by:
Hello everyone, hope someone can help me with this. I have a SQL stored procedure that inserts a record into a table, creates a cursor to fetch the last record that was added to get the unique...
2
by: Bnc119 | last post by:
Hello, I have written a C# COM server that has a few methods and a property called DataItems that returns an ArrayList. During the course of execution the ArrayList gets populated with several...
7
by: asenthil | last post by:
Hai to all, this is senthil... i'm now working in the field of VC++... i want to connect a mysql database... just now tried to retrieve rows from a simple mysql database by using VC++ My...
1
by: angappan | last post by:
to fetch a list of rows and columns from xml and to store it in array and how to count the dynamic rows and columns ........ Help with code and explanations .... Iam very new to xml...
2
by: sruthini | last post by:
Hi, I am doing send some values(signup form::firstname,lastname,title,organization) to mail id using javamail at the same time it should store in database, my problem is how to fetch values from...
20
by: sruthini | last post by:
Hi, I am doing send some values(signup form::firstname,lastname,title,organization) to mail id using javamail at the same time it should store in database, my problem is how to fetch values from...
1
by: yasmine | last post by:
Hi friends, I'm having a table which stores id as comma separated in string datatype. I want to fetch each of the value in a row in the form of array such as follows: table: sid ...
3
by: preethikuppusamy | last post by:
I have included banner images in an array and used settimeout fun to dislay it in my home page. Now i have included those banners in a table and now i have to fetch it from the table and include in...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.