PF2G Posted June 14, 2012 at 02:41 PM Report Share #462809 Posted June 14, 2012 at 02:41 PM Boas, eu estou a trabalhar numa galeria de imagens com .htaccess O que eu quero é se o $clean_ur[2]='all' aparecem todas se não aparecem as imagens cuja categoria é a selecionada. Mas não estou a conseguir, dá-me o erro 404 Página nao encontrada (que eu criei): /** GALERIA DE IMAGENS **/ $sel_titulo_album="SELECT * FROM album_lang WHERE lang='".$current_lang."'"; $titulo_album=mysql_query($sel_titulo_album) or die(mysql_error()); $row_titulo_album=mysql_fetch_assoc($titulo_album); ?> <ul> <?php $i=0; do{ if ($i==0) { ?> <li> <?php } echo '<a href="'.$current_lang.'/gallery/'.$row_titulo_album['link'].'-'.$row_titulo_album['id'].'">'; echo $row_titulo_album['titulo']; echo '</a>'; echo '</li>'; $i=$i+1; if ($i==1) { $i=0; } } while($row_titulo_album=mysql_fetch_assoc($titulo_album)); ?> </ul> <?php /* FIM GALERIA IMAGENS */ echo '<div class="clearfloat"></div>'; echo '</div>'; /*************************************************************************/ if($num_rows_content > 1 || !isset($clean_url[3])){ //Se existir mais que um produto apresenta a listagem de todos os existentes echo '<div id="products">'; echo "<h1 class='title'>".$pageTitle."</h1>"; echo '<div class="produts_list">'; $count_products = 1; ////////// IMAGENS TODAS //////////// /***************************/ if($clean_url[2]='all') { //Monta o SQL com LIMIT para exibição dos dados $sql = "SELECT * FROM album_images ORDER BY id ASC " . $pagination->getLimitSql(); $images = mysql_query($sql) or die(mysql_error()); ?> <table> <?php $i=0; while($ln = mysql_fetch_assoc($images)){ if ($i==0) { echo '<tr>'; } ?> <td> <table><tr><td> <?php echo '<a href="'.$ln['imagem'].'" rel="group">'. '<img src="'.$ln['imagem'].'" width="150px" height="150px"> </a>'; ?> <tr><td align="center"></td></tr></table> </td> <?php $i=$i+1; if ($i==4) { $i=0; } } ?> </table> <?php } ////////// IMAGENS P/ CATEGORIA //////////// /*******************************************************/ elseif ($clean_url[2]!='all') { //Monta o SQL com LIMIT para exibição dos dados $sel_album_categ="SELECT * FROM album_lang WHERE lang='".$current_lang."' AND titulo='".$row_titulo_album['titulo']."'"; $album_categ=mysql_query($sel_album_categ) or die(mysql_error()); $row_album_categ=mysql_fetch_assoc($album_categ); $sel_album="SELECT * FROM album WHERE id='".$row_album_categ['id_projecto']."'"; $album=mysql_query($sel_album) or die(mysql_error()); $row_album=mysql_fetch_assoc($album); $sql = "SELECT * FROM album_images WHERE id_projecto='".$row_album['id']."' ORDER BY id ASC " . $pagination->getLimitSql(); $images = mysql_query($sql) or die(mysql_error()); ?> <table> <?php $i=0; while($ln = mysql_fetch_assoc($images)){ if ($i==0) { echo '<tr>'; } ?> <td> <table><tr><td> <?php echo '<a href="'.$ln['imagem'].'" rel="group">'. '<img src="'.$ln['imagem'].'" width="150px" height="150px"> </a>'; ?> <tr><td align="center"></td></tr></table> </td> <?php $i=$i+1; if ($i==4) { $i=0; } } ?> </table> <?php } Link to comment Share on other sites More sharing options...
vrodrigues Posted June 15, 2012 at 05:12 PM Report Share #463147 Posted June 15, 2012 at 05:12 PM $sel_titulo_album="SELECT * FROM album_lang WHERE lang='".$current_lang."'"; porque é que tens '".$current_lang."'" não devia ser '.$current_lang'", não tens aspas a mais? isso funciona? Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted June 15, 2012 at 09:32 PM Report Share #463185 Posted June 15, 2012 at 09:32 PM (edited) porque é que tens '".$current_lang."'" não devia ser '.$current_lang'", não tens aspas a mais? isso funciona? pelo incrível que pareça, o código SQL está correcto. o resultado (supondo que $current_lang terá o valor 'pt') será SELECT * FROM album_lang WHERE lang='pt' se tens o erro 404 bem podes olhar para o código o quanto quiseres que não vai resolver nada o melhor para tentar resolver esse tipo de problemas é criar uma página onde é apresentada a informação do pedido depois criar uma regra no htaccess que todos os erros 404 serão redireccionados para essa página Edited June 15, 2012 at 09:34 PM by HappyHippyHippo IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now