beboo002 Posted September 25, 2007 Share Posted September 25, 2007 hello all i am createing a dynamic web site my problem is how to store last 5 value of $a. my $a value is 94 to 250 and each click the value of $a change how i am store last 5 value of $a. thanks Link to comment https://forums.phpfreaks.com/topic/70621-how-to-store-a-value/ Share on other sites More sharing options...
HuggieBear Posted September 25, 2007 Share Posted September 25, 2007 You could add it to an array each time, then just take the last 5 elements? Regards Huggie Link to comment https://forums.phpfreaks.com/topic/70621-how-to-store-a-value/#findComment-354878 Share on other sites More sharing options...
jaymc Posted September 25, 2007 Share Posted September 25, 2007 Providing $a is an array or a string with 250 values in with no spaces $a[246] $a[247] $a[248] $a[249] $a[250] Link to comment https://forums.phpfreaks.com/topic/70621-how-to-store-a-value/#findComment-354894 Share on other sites More sharing options...
beboo002 Posted September 25, 2007 Author Share Posted September 25, 2007 is $a value to take in session? Link to comment https://forums.phpfreaks.com/topic/70621-how-to-store-a-value/#findComment-354896 Share on other sites More sharing options...
jaymc Posted September 25, 2007 Share Posted September 25, 2007 Huh? No Give us an example of the entire contents of $a where $a = '123456789101112131415' or $a = an array of the values once we know how the data is manufactured, we can tell you what you can use to work with it and pull out those values Link to comment https://forums.phpfreaks.com/topic/70621-how-to-store-a-value/#findComment-354902 Share on other sites More sharing options...
beboo002 Posted September 25, 2007 Author Share Posted September 25, 2007 this is my code and i am find my $a value from my database <? $sql2="select * from tbl_cat where sub_cat_id='$a' "; $res2=mysql_query($sql2,$link);//$query=mysql_fetch_row($res); $COLS_PER_ROW = 2; $colCount = 0; $numRows = mysql_num_rows ($res2); while ($row2=mysql_fetch_array($res2)) { // Start a row whenever our count is divisible by the number of items in each row if ($colCount % $COLS_PER_ROW == 0) { echo "<tr>"; } echo "<td><td><td><td><a href='test.php?sub_cat_id=$row2[id] 'class=bluelinkfont >$row2[cat_name]</a></td></td></td></td>"; // End the row when the last space in the row has been filled, or when there are no more items in the result set. if ($colCount % $COLS_PER_ROW == $COLS_PER_ROW - 1 || $colCount == $numRows - 1) { echo "</tr>"; } $colCount++; } echo"<br><tr><tr>"; ?> Link to comment https://forums.phpfreaks.com/topic/70621-how-to-store-a-value/#findComment-354911 Share on other sites More sharing options...
beboo002 Posted September 25, 2007 Author Share Posted September 25, 2007 Actully i wanna made breade crumps plz check this link http://www.phpfreaks.com/forums/index.php/topic,160755.0.html Link to comment https://forums.phpfreaks.com/topic/70621-how-to-store-a-value/#findComment-354915 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.