Click to See Complete Forum and Search --> : save an array into a session


The Little Guy
11-05-2006, 08:37 PM
Here is what I currently have:
$sql2 = mysql_query("SELECT * FROM images WHERE user_id='$_SESSION[id]'")or die(mysql_error());
$row2 = mysql_fetch_array($sql2);
print_r(explode("", $row2['image_name'], -1));

I am searching the DB for the image names, and then putting them into an array. Once I get that done, I will switch out print_r with a variable, then I will save that variable into a session. But right now I am getting this error I don't know what it means:

Warning: explode() [function.explode]: Empty delimiter. in C:\Program Files\xampp\htdocs\portfolio\check_login.php on line 16

The Little Guy
11-05-2006, 08:41 PM
Ok I removed the warning, but The array shows only one variable in it, and there should be 2.

print_r(explode(' ', $row2['image_name']));

The Little Guy
11-05-2006, 08:58 PM
OK... I got it to get the values:

Here is how it looks:
Array ( [0] => 123 [image_name] => 123 [1] => 2 [user_id] => 2 )
Array ( [0] => 12344 [image_name] => 12344 [1] => 2 [user_id] => 2 )

I need to get [image_name], and place it into an array
here is what I currently have:

while($row2 = mysql_fetch_array($sql2)){
#$img_array = implode(',', $row2['image_name']);
print_r($row2);
}
#$_SESSION['images'] = $img_array;

#print_r($img_array);