You are here: Multidimensional Array Question « All PHP « IT news, forums, messages
Multidimensional Array Question

Posted by moosus on 09/19/06 02:55

I have a page which I on which I run 3 independent queries and collect the
latest 10 entries from each table.
The tables are identical just the data is different.

What I am trying to do is combine the 10 records I get from each table then
display the 10 most recent

I have been trying to get each of the 3 queries to output to a
multidimensional array using the following:

$bream = array($n, 'SID','TITLE','TIMESTAMP' );
$n = 0;
if ($r = mysql_query($query)){
while($breamrow = mysql_fetch_array($r)){
$bream = array(
'row' => '$n',
'sid' => $breamrow['sid'],
'title' => $breamrow['title'],
'time' => $breamrow['time']
);
$n = $n++;
}

I would create 3 identical arrays

$bream = array($n, 'SID','TITLE','TIMESTAMP' );
$bass = array($n, 'SID','TITLE','TIMESTAMP' );
$barra = array($n, 'SID','TITLE','TIMESTAMP' );

Then I was looking at doing:

$comb = array_merge($bream, $bass, $barra);

My problem at the moment is that the $bream array is not getting all the
data from the query

When I echo(count($bream)); I get 4 (I would have assumed 40)

When I do

foreach ($bream as $bream['row'] => $value){
print "<p>{$value['title']}&nbsp; - &nbsp;{$value['time']}</p>";

I get

$ - $

1 - 1

K - K

2 - 2





...... So long story short ... I'm completely lost

Any help ... Direction would be appreciated

Cheers
moosus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация