You are here: Re: array in array... « PHP SQL « IT news, forums, messages
Re: array in array...

Posted by Bob Stearns on 05/30/06 00:24

stjepko wrote:
> I need help. I have done this:
>
> $sql = "SELECT jedan.ime, jedan.text, dva.rb, dva.opis, dva.proizvod,
> dva.sifra, dva.cijena
> from jedan, dva WHERE jedan.ime=dva.ime ";
> $result = mysql_query($sql,$link) or die("ERROR IN
> QUERY:".$sql."<br>".mysql_error());
> while($row = mysql_fetch_array($result))
> {
> include "show.php";
> }
>
>
> and show.php is:
>
> table>
> <tr>
> <td><?= $row["ime"]?></td>
> <td><?= $row["text"]?></td>
> </tr>
> <tr>
> <td><?= $row["rb"]?></td>
> <td<?= $row["opis"]?></td>
> <td><?= $row["proizvod"]?></td>
> <td><?= $row["sifra"]?></td>
> <td><?= $row["cijena"]?></td>
> </tr>
> </table
>
> The problem is in row ime and text. I have to get something like this:
>
> Ime1 Text1
> 1. rb opis proizvod sifra cijena
> 2. rb opis proizvod sifra cijena
> ...
>
> Ime2 Text2
> 1. rb opis proizvod sifra cijena
> 2. rb opis proizvod sifra cijena
>
> but i got:
>
> Ime1 Text1
> 1. rb opis proizvod sifra cijena
> Ime1 Text1
> 2. rb opis proizvod sifra cijena
> ...
>
> Please help...
> tnx
>
>
It should be a simple fixup:
change the line 'include show.php' to
if($row["ime"]!=$old_ime || $row["text"]!=$old_text) {
include show1.php;
$old_ime = $row["ime"];
$old_text = $row["text"];
}
include show2.php

With show1 and show2 being the approptiate parts of show.

 

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

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