PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 9th, 2005, 04:18 AM
Dulcinea Dulcinea is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 23 Dulcinea User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 49 sec
Reputation Power: 0
Send a message via Yahoo to Dulcinea
Exclamation Retrieve array data using php

Hi all,

I face a problem when i want to retrieve array data using php from mysql database.

$testplatform=unserialize($row8['test_platform']);
foreach($testplatform as $my_test_platform){
print "<table border=\"0\" height=\"100%\" width=\"100%\"><tr><td class=\"font10\" bgcolor=\"$color\">$my_test_platform</td></tr></table> ";


the code above works well. The problem is, i want to retrieve another array data from database that is for the $color at the same time but i cant do well for this. How can i put another foreach in order to retrieve array data for $color? or can one of you recommend the best way to solve the problem?

I do appreciate anyone's help!

Regards;
Dulcinea

Reply With Quote
  #2  
Old March 9th, 2005, 06:16 PM
Dulcinea Dulcinea is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 23 Dulcinea User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 49 sec
Reputation Power: 0
Send a message via Yahoo to Dulcinea
Exclamation Array Data

Is it possible to retrieve an array data one by one?

Please, I need someone explanation!

regards;
Dulcinea

Reply With Quote
  #3  
Old March 10th, 2005, 07:55 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
I don't understand your question.

Here is an example of getting array data one by one
PHP Code:
<?php
$pets
[]="Cat"
$pets[]="Dog"
$pets[]="Bird"

foreach($pets As $pet) {
    echo 
"I have a $pet<br>";
}
?>
Alternatively, you could call $pets[2] to retrieve the value "Bird"

Reply With Quote
  #4  
Old March 13th, 2005, 06:52 PM
Dulcinea Dulcinea is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 23 Dulcinea User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 49 sec
Reputation Power: 0
Send a message via Yahoo to Dulcinea
Question Array Data

This is my code:

$type_package=unserialize($row7['type_package']);
$status1=unserialize($row18['status1']);


foreach( $status1 as $mystatus1 ) {
foreach( $type_package as $my_type_package ){
print "<table border=\"0\" height=\"100%\" width=\"100%\"><tr><td bgcolor=\"#FDEAFD\" class=\"font10\">$mystatus1 $my_type_package </td></tr></table> ";
}
}

for instance;
$mystatus={1,2} and $my_type_package={a,b}

so, the output for the above coding is 1a,1b,2a,2b. How can i manage to get only 1a2b instead of 1a1b2a2b? That is the problem that i face actualy. I hope there is someone out there can help me to solve the solutions!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Retrieve array data using php


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT