Is there a way to put the results of mysql_fetch_array into a session?
ex:
$sql = "SELECT ID FROM DATA";
while ($row = mysql_fetch_array($sql)) {
echo $row['id'] //i need all of the results for this in a session
}
not sure how much sense that makes, but maybe someone here understands me
mysql_fetch_array
Moderator: General Moderators
-
billybonz81
- Forum Newbie
- Posts: 3
- Joined: Sat Oct 02, 2004 2:43 am
- Location: baytown, tx
-
denlou
- Forum Newbie
- Posts: 17
- Joined: Fri Sep 24, 2004 7:11 pm
- Location: Richmond/Vancouver, BC
- Contact:
Like this??
I have no easy way to execute this script, but try that.
Code: Select all
<?php
session_start();
$sql = "SELECT id FROM date";
while ($row = mysql_fetch_array($sql))
{
$_SESSION[$row[id]] = $row[id];
}
?>- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
I'd store it into a single array inside the session..
Code: Select all
$_SESSION['fetch'] = array();
while($row = mysql_fetch_assoc($results)) $_SESSION['fetch'][] = $row['id'];