Ir para conteúdo
Fórum Script Brasil

paulorof_ce

Membros
  • Total de itens

    4
  • Registro em

  • Última visita

Sobre paulorof_ce

paulorof_ce's Achievements

0

Reputação

  1. Tudo bem! A idéia foi boa mas tá dando agora o seguinte erro: Warning: pg_query() [function.pg-query]: Query failed: ERROR: column "exc_marc" does not exist LINE 1: delete from produtos where codigo = exc_marc ^ in C:\xampp\htdocs\ajax\post2\acao_exc_marc.php on line 9 Problemas ao excluir dados selecionados! a coluna na tabela se chama produto[0]. Mesmo assim valeu. Vou pesquisar por aí pra ver se acho algo e depois posto a solução aqui.
  2. :wacko: Pessoal Estou querendo excluir vários registros através de checkbox fiz o seguinte: Cod do checkbox: print "<td><input type='checkbox' name='exc_marc[]' value='$produto[4]'></td>"; Cod de exclusão: $mexc_marc= explode(",",exc_marc); for ($i=0;$i<length($mexc_marc);$i++){ $sql= "delete from produtos where codigo = $mexc_marc[$i]"; pg_query($conexao,$sql); } sendo que ele mostra o seguinte erro: Fatal error: Call to undefined function length() in C:\xampp\htdocs\ajax\post2\acao_exc_marc.php on line 7 alguém pode me ajudar?
  3. Eu testei. O concerto da escrita deu certo, porém, ele não mostra nem a página e nenhum resultado, ele mostra só o conteúdo dizendo ´"nenhuma última notícia" if (@mysql_num_rows($resultado2) == 0) die ("Nenhuma última notícia!"); Se eu possuo no banco de dados por exemplo duas notícias da seção 2 ele ainda mostra esse erro. Vou postar o código completo da página. <?php require_once('Connections/conrecadinhos.php'); ?> <?php //Consulta para o leitor $sql = "SELECT * FROM noticias WHERE id=".$_GET['id']." AND not_status = '1' "; $resultado = mysql_query($sql) or die ("Não foi possível realizar consulta!"); if (@mysql_num_rows($resultado) == 0) die ("Nenhum registro encontrado!"); $linha=mysql_fetch_array($resultado); // Consulta para o ùltimas notícias A PARTIR DE SECAO DEFINIDA VIA URL //$sql2 = "SELECT * FROM noticias WHERE not_status = '1' ORDER BY id DESC LIMIT 5"; $sql2 = "SELECT not_titulo,not_data,not_secao FROM noticias WHERE not_status = '1' AND '".$_GET['not_secao']."' ORDER BY id DESC LIMIT 5"; $resultado2 = mysql_query($sql2) or die (mysql_error()); if (@mysql_num_rows($resultado2) == 0) die ("Nenhuma última notícia!"); ?> <html> <head> <title>::: <?php echo $linha['not_titulo']; ?> :::</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="keywords" content="keyword1, keyword2, keyword3"> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; background-image: url(imagens/bgpaginas.gif); margin-bottom: 0px; } --> </style> <link href="css/cnsgestilos.css" rel="stylesheet" type="text/css"> <link href="ferramentas_css/noticias.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- .style1 {color: #FFFFFF} --> </style> </head> <body bgcolor="#ffffff"> <table border="0" cellpadding="0" cellspacing="0" width="811"> <!--DWLayoutTable--> <tr> <td height="216" colspan="3" valign="top" bgcolor="#FFCC00"><?php include('menu_top.php'); ?></td> <td width="8" rowspan="3" valign="top" background="imagens/smb_princi.gif"><img src="imagens/smb_princi.gif" width="8" height="8"></td> </tr> <tr> <td width="616" height="509" valign="top"><table width="100%" height="100%" border="0" cellpadding="0" background="imagens/bg_principal.jpg" cellspacing="0" bgcolor="#993300"> <!--DWLayoutTable--> <tr> <td width="616" height="100%" valign="top"><div align="center"> <p> <?php include('topo_img.php'); ?><span class="nottitulo"><strong><?php echo $linha['not_titulo']; ?></strong></span></p> <p align="right"><span class="notdata">Publicado em: <?php $linha['not_data'] ?> <?php echo date('d/m/Y', strtotime($linha['not_data'])); ?></span></p> <blockquote> <p align="justify" ><span class="nottexto"><?php echo nl2br($linha['not_texto']); ?></span></p> </blockquote> <p align="center" class="nottexto">&nbsp;</p> <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFCC"> <tr> <td bgcolor="#003399"><div align="center"><span class="nottexto style1"><strong>&Uacute;ltimas Not&iacute;cias - Geral</strong></span></div></td> </tr> <tr> <td><ul class="seta"> <div align="left"><span class="nottexto"> <?php while ($linha2 = mysql_fetch_array($resultado2)) { ?> </span></div> <li class="nottexto"> <div align="left"><a href="not_leitor.php?id=<?php echo $linha2['id']; ?>&secao=<?php echo $linha2['not_secao']; ?>" class="linkazul"> <?php $linha2['not_data'] ?> <?php echo date('d/m/Y', strtotime($linha2['not_data'])); ?> - <?php echo $linha2['not_titulo']; ?></a><?php } ?></div> </li> </span></ul></td> </tr> </table> <p> <p align="left" class="textoint"><a href="java script:history.back()"><img src="imagens/voltar.gif" width="25" height="25" border="0" align="left"></a><a href="index.asp" class="linkint">VOLTAR</a> </p> </div></td> </tr> </table></td> <td width="4" valign="top"><img src="imagens/espaco_branco.gif" width="4" height="4"></td> <td width="183" valign="top" bgcolor="#003399"><?php include('lateral-dir.php'); ?></td> </tr> <tr> <td height="45" colspan="3" valign="top" background="imagens/bg_fimsite.gif"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="798" height="45" valign="middle"><div align="center" class="textobuscasite">Melhor visualizado em 1024x768<br> Copyright&copy;2003 Col&eacute;gio Nossa Senhora das Gra&ccedil;as. Todos os direitos reservados.</div></td> <td width="5" valign="top"><img src="imagens/bg_fimsite.gif" width="2" height="45"></td> </tr> </table></td> </tr> </table> </body> </html> <?php mysql_free_result($resultado); mysql_free_result($resultado2); ?> Obrigado pela compreensão!
  4. Olá pessoal sou novo no Fórum e no PHP também. Comecei a elaborar um sisteminha (mesmo sabendo que existem muitos prontos) de notícias para fins de aprendizagem. Sendo que estou engachado na questão da query string. 1º Tenho a ID da notícia e consigo utilizar normalmente esta query string, tipo no exemplo: noticias.php?id=1. 2º Conseguir também colocar que cada notícia tenha sua categoria e fazer isso aparecer no link tipo: noticias.php?id=1&secao=2 3º O problema é quando vou listar as últimas notícias, eu queria que o código sql fizesse com que listasse somente as últimas da seção que vai ser mostrada na url quando o usuário escolher a notícia. Código abaixo: // Consulta para o ùltimas notícias A PARTIR DE SECAO DEFINIDA $sql2 = "SELECT * FROM noticias WHERE not_status = '1' AND secao=".$_GET['not_secao']." ORDER BY id DESC LIMIT 5"; $resultado2 = mysql_query($sql2) or die ("Não foi possível mostrar as últimas notícias"); if (@mysql_num_rows($resultado2) == 0) die ("Nenhuma última notícia!"); Sendo que o código só mostra a menssagem "Não foi possível mostrar as últimas notícias" Como devo fazer para capturar isso no sql?
×
×
  • Criar Novo...