/    Sign up×
Community /Pin to ProfileBookmark

save an array into a session

Here is what I currently have:

[code=php]$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));[/code]

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:

[B]Warning[/B]: explode() [function.explode]: Empty delimiter. in C:Program Files[B]xampphtdocsportfoliocheck_login.php[/B] on line [B]16[/B]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@The_Little_GuyauthorNov 06.2006 — Ok I removed the warning, but The array shows only one variable in it, and there should be 2.

[code=php]print_r(explode(' ', $row2['image_name']));[/code]
Copy linkTweet thisAlerts:
@The_Little_GuyauthorNov 06.2006 — OK... I got it to get the values:

Here is how it looks:

[B]Array ( [0] => 123 [image_name] => 123 [1] => 2 [user_id] => 2 )

Array ( [0] => 12344 [image_name] => 12344 [1] => 2 [user_id] => 2 )[/B]


I need to get [image_name], and place it into an array

here is what I currently have:
[code=php]
while($row2 = mysql_fetch_array($sql2)){
#$img_array = implode(',', $row2['image_name']);
print_r($row2);
}
#$_SESSION['images'] = $img_array;

#print_r($img_array);
[/code]
×

Success!

Help @The_Little_Guy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...