Jump to content


R.Sanchez

Member Since 05/08/2005
Offline Last Active 23/04/2007, 10:00
-----

Topics I've Started

Nao Consigo Inserir Dados No Banco, Nao Conecta!

20/04/2007, 09:55

Ae galera, to recorrendo a vcs...
olha oq aparece qdo tento cadastrar um cliente:

Erro: Não foi possível realizar a conexão"); $db=mysql_select_db($dbname, $conn) or die ("Erro: Base de Dados inexistente"); ?>
Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in c:\wamp\www\exemplo\insere_prospect.php on line 16

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in c:\wamp\www\exemplo\insere_prospect.php on line 16

Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in c:\wamp\www\exemplo\insere_prospect.php on line 17

Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\exemplo\insere_prospect.php:4) in c:\wamp\www\exemplo\index.php on line 1


Eu instalei o wamp e o easyphp mas a mesma coisa, a unica coisa q mexi na config. e no register_globals = ON.

Cadastro.php (naun vou postar o codigo inteiro, apenas a parte principal)
[codebox]
<form name="cadastro_prospect" method="post" action="insere_prospect.php">


CODIGO...


<input type="submit" value="Enviar" name="ok">
<input type="reset" value="Limpar" name="reset"></p>
</form>
[/codebox]


conecta_db.php
[codebox]<?
$dbname="dentalprado";
$conn=mysql_connect("localhost/exemplo", "root", "") or die ("<b><font size='5'>Erro: </font></b>Não foi possível realizar a conexão");
$db=mysql_select_db($dbname, $conn) or die ("<b><font size='5'>Erro: </font></b>Base de Dados inexistente");
?>[/codebox]

e insere_prospect.php
[codebox]<html>
<head><title>Cadastro</title></head>
<body vlink="0000ff">
<?php
require("conecta_bd.php");

if((!$nome) || (!$cpf_cnpj) || (!$endereco) || (!$numero_endereco) || (!$cidade) || (!$uf) || (!$telefone) || (!$email))
{
echo "<font face='verdana' size='2'>Por favor, preencha todos os campos em vermelho.</font>
<p><a href='java script:history.back()'><font face='verdana' size='2'>Voltar</font></a>";
}
else
{
$sql="insert into cadastro_prospect (cod_cliente, nome, cpf_cnpj, endereco, numero_endereco, cep, cidade, uf, data_nascimento, telefone, email, interesse, especialidade, como_conheceu, aceita_publicidade)
values ('', '$nome', '$cpf_cnpj', '$endereco', '$numero_endereco', '$cep', '$cidade', '$uf', '$data_nascimento', '$telefone', '$email', '$interesse', '$especialidade', '$como_conheceu', '$aceita_publicidade')";
$result=mysql_query($sql);
mysql_close($conn);
include("index.php");
}
?>
</body>
</html>[/codebox]


entaooo naun sei oq esta errado meu amigo testou e disse que ta tudo certo mais aki no serviço e em ksa naun pega =/
help ae galera ;)

Abração!!!

Problemas Com Include

19/03/2007, 09:16

Primeiramente Bom dia a todos galera!

to com um probleminha no site que estou fazendo...
seguinte,

a index do meu site é uma tabela dividida entre topo, menu, conteudo, e rodape
dentro de cada div dessas eu do um include com as respectivas paginas...

Ai vem o problema:

Todas as paginas abrem na parte de conteudo atraves de query string e include...

mas quando abro uma pagina com conteudo mto grande, o menu fica centralizado ;/
ao invés de ficar no topo... (ver foto)

ja tentei varias formas de colocar a pagina menu no topo mas naun consegui...
entao recorro a vcs!

Foto:Posted Image

Index.php
<?php header("Content-Type: text/html; charset=ISO-8859-1",true) ?>

<html>
<head>
<meta http-equiv="Content-Language" content="pt-br">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Index</title>
</head>

&lt;script type="text/javascript" language="javascript" src="XHConn.js"></script>

&lt;script>var myConn = new XHConn();/*aqui eu chamo a funcao que tem o objecto com o metodo definido  */
if (!myConn) alert("deu erro aqui.");/*aqui e  a famoso deu erro na inclusão do xhConn.js */
var inclusao = function (oXML) { document.getElementById('include').innerHTML = oXML.responseText; }; /*aqui e variavel onde vai ser include*/

function incluir (url){	document.getElementById('include').innerHTML = "<img src='loading.gif' />";

/*aqui em cima e aquela imagens de carregando criei uma imagens vc pra dar umefeito legal */

myConn.connect("include.php", "GET", "variavel="+url, inclusao);	/*aqui rola a ação eu mandou pra pagina include.php com	  metodo get o value	 da variavel + o conteudo e onde deve atualizar  que no case e dentro do div include */

	 }</script>
	 
</head>
<body topmargin="0" leftmargin="0">
<div align="left">
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="780" height="100" id="AutoNumber1">
	<tr>
	  <td width="780" height="53" colspan="2">
	  <?php include("topo.php"); ?></td>
	</tr>
	<tr>
	  <td width="700" height="338">
	  <?php include("menu.php"); ?></td>
	  <td id="include" width="564" height="338">
	  <?php include("conteudo.php"); ?></td>
	</tr>
	<tr>
	  <td width="780" height="29" colspan="2">
	  <?php include("rodape.php"); ?></td>
	</tr>
  </table>
</div>

</body>

</html>

Abraços!

Script Que Muda Imagem A Cada Acesso

22/11/2006, 08:44

<script language="Javascript" type="text/javascript">

var numero_de_banners = "3"; //Número de imagens, altere se quiser

var banner = new Array(32); //Cria um conjunto de 32 elementos
banner[0]="<img src='LINK_PARA_A_IMAGEM' border='0' />"; //Elemento 1
banner[1]="<img src='LINK_PARA_A_IMAGEM' border='0' />"; //Elemento 2
banner[2]="<img src='LINK_PARA_A_IMAGEM' border='0' />"; //Elemento 3
//Adicione outros elementos se quiser, seguindo a ordem do conjunto
//Mas lembre-se de alterar o número de imagens também

//Multiplica o número de imagens por
//Um número flutuante aleatório, entre 0 e 1
var sorteio = Math.random() * numero_de_banners;
sorteio = Math.round(sorteio); //Arredonda o número recém-obtido
var banner_escolhido = banner[sorteio]; //Finalmente, define o banner escolhido


//Por fim, escreve no documento o resultado:
document.write("<center><a href='ALGUM_LINK''>"+banner_escolhido+"</a></center>");
</script>


Peguei esse codigo em um site mas naun estou conseguindo fazer ele pegar...
alguem sabe como ??? talvez eu esteja colocando no lugar errado, ou falta alguma coisa do codigo...
alguem sabe ? Abraçosss galera t+

Como Fazer Query String Desse Jeito ?

24/05/2006, 10:02

ae galaera tah mto xxxxxx to fazendo um site pra um estagio e me compliquei, queria fazer um site com query string mas o site possui varios includes... e naun ta dando nada certo

index.php
<html>
<head>
<title>DENTAL PRADO - PRODUTOS ODONTOLÓGICOS</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<div align="left"></div>
<body topmargin="2" leftmargin="2">
<table width="93%" height="245" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse">
  <tr style="margin-top: 0; margin-bottom: 0">
	<td width="100%"><?php include("logo/logo.htm"); ?></td>
  </tr>
  <tr style="margin-top: 0; margin-bottom: 0"> 
	<td width="100%"><?php include("conteudo.php"); ?></td>
  </tr>
</table>
</body>
</html>

na index.php dei dois includes, logo.php e o conteudo.php

=====================================================================


conteudo.php
<html>
<head>
<title>Documento sem t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body topmargin="2" leftmargin="2">

<div align="left">
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="806" height="327" id="AutoNumber1">
	<tr>
	  <td width="515" height="88" colspan="2"><?php include("noticias/noticias.php"); ?></td>
	  <td width="81" height="286" rowspan="2"><?php include("empresas/empresas.htm"); ?></td>
	</tr>
	<tr>
	  <td width="94" height="198"><?php include("menu/menu.php"); ?></td>
	  <td width="421" height="198"><?php include("equiprado/equiprado.htm"); ?></td>
	</tr>
	<tr>
	  <td width="602" height="37" colspan="3"><?php include("copyright/copyright.htm"); ?></td>
	</tr>
  </table>
</div>

</body>

</html>

agora no conteudo.php ele da includes para as partes dos site, fiz assim pensando em poder atualizar facilmente...


=====================================================================


menu.htm
<body topmargin="0" leftmargin="0">

<div align="left">
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="177" height="406" id="AutoNumber1">
	<tr>
	  <td width="182" height="296" background="menu/bg_menu.jpg">
	  <div align="center">
		<center>
	  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="93%" id="AutoNumber2" height="338">
		<tr>
		  
<td width="100%" height="19"> <font face="Arial Unicode MS" size="2" color="#333333">&nbsp;&nbsp;&nbsp;&nbsp; 
<a href="index.php?secao=teste" style="text-decoration: none"> <font color="#000000">Empresa</font></a>&nbsp;&nbsp;&nbsp; 
</font> </td>
		</tr>
		<tr>
		  <td width="100%" height="19">
		  <font face="Arial Unicode MS" size="2" color="#333333">&nbsp;&nbsp;&nbsp;&nbsp; 
		  Cadastro</font></td>
		</tr>
		<tr>
		  <td width="100%" height="19">
		  <font face="Arial Unicode MS" size="2" color="#333333">&nbsp;&nbsp;&nbsp;&nbsp; 
		  Promoções</font></td>
		</tr>
		<tr>
		  <td width="100%" height="19">
		  <font face="Arial Unicode MS" size="2" color="#333333">&nbsp;&nbsp;&nbsp;&nbsp; 
		  Equipamentos</font></td>
		</tr>
		<tr>
		  <td width="100%" height="19">
		  <font face="Arial Unicode MS" size="2" color="#333333">&nbsp;&nbsp;&nbsp;&nbsp; 
		  Filiais</font></td>
		</tr>
		<tr>
		  <td width="100%" height="19">
		  <font face="Arial Unicode MS" size="2" color="#333333">&nbsp;&nbsp;&nbsp;&nbsp; 
		  Revista Dental Prado</font></td>
		</tr>
		<tr>
		  <td width="100%" height="19"><font size="2" color="#666666">&nbsp;</font></td>
		</tr>
		<tr>
		  <td width="100%" height="19"><font size="2">&nbsp;</font></td>
		</tr>
		<tr>
		  <td width="100%" height="19">&nbsp;</td>
		</tr>
		<tr>
		  <td width="100%" height="19">&nbsp;</td>
		</tr>
		<tr>
		  <td width="100%" height="19">&nbsp;</td>
		</tr>
		<tr>
		  <td width="100%" height="19">&nbsp;</td>
		</tr>
		<tr>
		  <td width="100%" height="19">&nbsp;</td>
		</tr>
		<tr>
		  <td width="100%" height="19">&nbsp;</td>
		</tr>
		<tr>
		  <td width="100%" height="19">&nbsp;</td>
		</tr>
		<tr>
		  <td width="100%" height="19">&nbsp;</td>
		</tr>
		<tr>
		  <td width="100%" height="24">&nbsp;</td>
		</tr>
	  </table>
		</center>
	  </div>
	  </td>
	</tr>
  </table>
</div>

</body>

Agora vem o desafio rsrsrs como fazer abrir uma pagina no lugar da pagina "conteudo.php" que fica la na index.php, so eh ver a index que vc ve la o include do conteudo.php...


eu naun consegui... pois sei mto pouco de php

Abraçosssss t+ :blink:

IPB Skin By Virteq