Hi
I just realized that my example was too simple for my final needs
In my real example this tables have books and authors.
some books have more then 1 author..
and i need to print it like this:
Code:
<div id="contentdiv">
<?php
$i = 0;
do {
?>
<?php
$i = $i + 1;
?>
<div id="contentdiv<?php echo $row_rs_livros2['id_li']; ?>" <?php if ($i <= 1) { echo "style='display: block;'"; } else { echo "style='display: none;'"; }?>>
<a href="livros.php?id_li=<?php echo $row_rs_livros2['id_li']; ?>" class="titulos_vermelho_livros"><?php echo $row_rs_livros2['livro']; ?></a><br/><br/>
<?php //here i'll have more then 1 author sometimes ?>
<span class="texto"><a href="autores.php?id=<?php echo $row_rs_livros2['id']; ?>" class="titulos_livros"><?php echo $row_rs_livros2['nome']; ?><?php echo $row_rs_livros2['apelido']; ?></a><br>
<?php
mb_internal_encoding("UTF-8");
$str = $row_rs_livros2['texto'];
$limit = 300; //Specify the length of the new substring
if (substr($str, $limit, 1) != ' ' && ($l = mb_strrpos(mb_substr($str, 0, $limit), ' '))) {
echo mb_substr($str, 0, $l);
} else {
echo mb_substr($str, 0, $limit);
}
?>(...)<br />
<a href="livros.php?id_li=<?php echo $row_rs_livros2['id_li']; ?>" class="style3">ver mais »</a></span></div>
<?php } while ($row_rs_livros2 = mysql_fetch_assoc($rs_livros2)); ?>
</div>
</div>
at the moment my query is still this:
SELECT autores.id, autores.nome, autores.apelido, livros.id_li, livros.texto, livros.pdfs, livros.foto, livros.foto_grande, livros.livro, livros.ordem, ids.id_livro FROM autores INNER JOIN ids ON autores.id=ids.id_autores INNER JOIN livros ON ids.id_livro=livros.id_li WHERE estado = 'on' ORDER BY livros.ordem