Hey,
according to php.net a good way to put things into an array is as follows.
$i=array(1, 2, 3, 4);
now keeping with that respect....
I'm looking to do a "last viewed page" setup. Where all the user names are stored in a sql row in the forum of user1, user2, user3, user4, user5.
so! when i pull it of the mysql table and pop it into an aray it will look like php.net example!
//from above
$i=array(1, 2, 3, 4)
//from my code
echo $result['last_viewed'];
//out put
user1, user2, user3, user4, user5
so i then should be able to do the following!
$i=array($result['last_viewed']);
right??
my end goal would be to seperate each value @ the , and give each value a number. where i would then advance each value by one, replace the last value with the current user, put it back the form of user1, user2, user3, user4, user5 and put it back in to the mysql table.(with a little error checking to be sure it's not the same user over and over again).
so i have this
//get the current list of 5 :)
$g_lv_string=("SELECT last_view FROM profile WHERE username='$view_user'");
$g_lv_query=mysql_query($g_lv_string, $db) or $error='<center id="error">Error while getting the last 5 from the database <br />'.mysql_error().'</center>';
$g_lv_result=mysql_fetch_assoc($g_lv_query);
$my_array =array($g_lv_result['last_view']);
if(is_array($my_array))echo 'yes';
for($c='0'; isset($my_array[$c]); $c++)
{
echo $my_array[0];
}
basically along the same thinking from php.net
//from php.net
<?php
$arr = array(1, 2, 3, 4);
foreach ($arr as &$value) {
$value = $value * 2;
}
// $arr is now array(2, 4, 6, 8)
?>