General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

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 September 4th, 2003, 04:11 PM
scrubbler scrubbler is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 4 scrubbler User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
passing arrays from page to page

Hello, I'm learning this stuff very slowly so please take nothing (my knowledge) for granted ;p.

I'm trying to pass an associative array from one page to another so that I can retreave what ever values I need when ever I need them.

I can do this varaible by variable, but that seems a bit tedious.

Thanx in advance :]

PHP Code:
// this is the php script that creates an array for all of my users info.
// the array is called $getinfo.
<?
require (
'auth.inc');
$query 'SELECT * FROM users WHERE sessID = "' $_COOKIE['alpha8'] . '"';
$result mysql_query ($query);
$getinfo mysql_fetch_assoc ($result);
header ('Location: flash.php?userinfo=' .($getinfo);
?>

// This is the page where im trying to retreive the value of one of the indices (variables) in my array getinfo[].

<head>
    <title>Page 2</title>
    <link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
    <a href="getinfo.php">page 1</a>
        <?
        
echo $userinfo[myVariable];
        
?>
</body>
</html> 

Reply With Quote
  #2  
Old September 4th, 2003, 04:52 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
I'd be pretty surprised if that worked. You should consider using sessions, which will allow you to pass objects and arrays around. Failing that, I guess you could use the serialize() function to convert your array to a string, pass the string in your query string, and use unserialize in the second page to extract the values. You'd probably run into url length issues if the array got too big. Go with sessions, I say, or just pass the user id to the next page and do your query again (or better yet, do the query only on the second page after determining that the given user is logged in).

Reply With Quote
  #3  
Old September 4th, 2003, 07:09 PM
scrubbler scrubbler is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 4 scrubbler User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanx

Thank you ... boy this stuff sure is different than what I'm used to . (Flash ActionScript)

In ActionScrit you just scope the name of your array wherever you like (movieclip/_level/etc.) and then access any index at will. There are no associative arrays in ActionScript though... I wish there were.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > passing arrays from page to page


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 2 hosted by Hostway
Stay green...Green IT