Ir para conteúdo
Fórum Script Brasil
  • 0

Erro Pegando Dados (resolvido)


nbr2004

Pergunta

Olá Pessoal estou com um problema, vejam só estou pegando uma categoria e dentro dela é pra exibir as subcategorias, exemplo:

Categoria: Alimentação

Subcategoria: Biscoito

até aí tudo bem,

ele gera esse link

http://guiaunai.com.br/empresas.php?cat=Al...ubcat=Biscoitos

só que quando tem espaço na categoria dá errado, veja

Categoria: Engenharia e arquitetura

Subcategoria: Agronomia

ele gera esse link

http://guiaunai.com.br/empresas.php?cat=Engenharia

ele não completa o resto, poderiam me ajudar?

Segue o codigo abaixo

<? $numcat = $_GET['categoria']?>
 <?  include "conexao.php";?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><? include "includes/titulo.php"; ?></title>
<link href="estilos/estilos.css" rel="stylesheet" type="text/css">
</head>
<body>
<script language="javascript" src="js/funcoes.js"></script>
<?
include "includes/topo.php";
?>
<table width="777" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="5"></td>
  </tr>

</table>

<table width="777" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>

    <td width="172" valign="top"><table width="172" height="20" border="0" cellpadding="0" cellspacing="1">

      <tr>

        <td width="172" background="imagens/fundo_categoria.jpg">&nbsp;</td>

      </tr>
      <?
      $sql = mysql_query("SELECT * FROM catalago_categorias ORDER BY categoria") or die ('Falha exibindo categorias');
      while($linha = mysql_fetch_array($sql))
      {
            $id = $linha["id"];
          $categoria = $linha["categoria"];
          echo "<tr>";
          echo "<td width='172' height='20' background='imagens/fundo_categorias.jpg' class='style1'>&nbsp;&nbsp;<a href='secao.php?categoria=".$id."'><span class='style3'>".$categoria."</span></a></td>";
          echo "</tr>";
      }
      ?>
    </table></td>
    <td width="500" valign="top"><table width="499" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#BFDFF0">
      <tr>
        <th scope="col"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="100%" height="18"></td>
          </tr>
        </table>
          <table width="90%" align="center">
            <tr>
              <td width="188" valign="top"><?
$sql2 = mysql_query("SELECT * FROM catalago_categorias where id = '$numcat'") or die ('Falha na Query');
while ($linha2=mysql_fetch_array($sql2)) {
$qualcat = $linha2["categoria"];
}

$sql3 = mysql_query("SELECT * FROM catalago_subcategorias where categoria = '$qualcat' order by subcategoria limit 0,30") or die ('Falha na Query');
while ($linha3=mysql_fetch_array($sql3)) {
$subcat = $linha3["subcategoria"];
echo "<font face=verdana size=1>&nbsp;&nbsp;<img src=imagens/seta.gif>&nbsp;<a href=empresas.php?cat=$qualcat&subcat=$subcat>$subcat</a></font><br>";
}
?>
              </td>
              <td width="189" valign="top"><?
$sql4 = mysql_query("SELECT * FROM catalago_subcategorias where categoria = '$qualcat' order by subcategoria limit 30,60") or die ('Falha na Query');
while ($linha4=mysql_fetch_array($sql4)) {
$subcat = $linha4["subcategoria"];
echo "<font face=verdana size=1>&nbsp;&nbsp;<img src=imagens/seta.gif>&nbsp;<a href=empresas.php?cat=$qualcat&subcat=$subcat>$subcat</a></font><br>";
}
?>
              </td>
            </tr>
          </table></th>
      </tr>
    </table></td>
    <td width="105" valign="top"><table width="105" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center" valign="top"><?

include "includes/menu_direito.php";

?>
        </td>
      </tr>
    </table></td>

  </tr>

</table>

<?

include "includes/rodape.php";

?>

</body>

</html>

Link para o comentário
Compartilhar em outros sites

7 respostass a esta questão

Posts Recomendados

  • 0

http://br.php.net/manual/pt_BR/function.urlencode.php

http://br.php.net/manual/pt_BR/function.urldecode.php

Opa... as funções não têm "_"... heheh foi mal

Teste este código e veja:

<?php
$t = "Engenharia de Alimentos";
$t_en = urlencode  ($t);
$t_de = urldecode ($t_en);
echo $t_en . "<br />". $t_de;
?>

[]'s

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...