Dimitrov
-
Total de itens
18 -
Registro em
-
Última visita
Posts postados por Dimitrov
-
-
Não deu pra entender nada. Vamos simplificar... Onde está seu comando sql com o update?
é este
<input name="txt_categoria" type="text" id="txt_categoria" size="35" value= "<?php echo @mysql_result($sql,0,categoria); ?>"/>
-
Gostaria de saber porque não consigo alterar meus dados no mysql,o codigo esta certo,aparentemente pelo menos,pois é pra clicar no botao alterar e depois ele ir para o input ,dai pra mim alterar o nome dele.mas ele ao clicar em alterar ele não esta indo para o input =/
por favor alguém me de uma ajuda ai.
obrigado
Categoria.php
<?php include "conexao.php" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <table width="750" border="0" align="center"> <tr> <td colspan="2"><?php include('cabecalho.php'); ?></td> </tr> <tr> <td width="200"><?php include('menu.php'); ?></td> <td width="583"><table width="100%" border="0"> <tr> <td> </td> </tr> <tr> <td align="center" style="font-size: 14px; text-align: center;"><p>categoria</p> <?php if ($acao != "") { $sql = mysql_query ("SELECT * from Categorias Where id_categoria = $id"); ?> <form id="form1" name="form1" method="post" action="<? echo $PHP_SELF ?>"> <table width="300" border="1" align="center" cellpadding="2" cellspacing="0"> <tr> <td width="143">Categoria</td> <td width="147"><label> <input name="txt_categoria" type="text" id="txt_categoria" size="35" value= "<?php echo @mysql_result($sql,0,categoria); ?>"/> </label></td> </tr> <tr> <td colspan="2" align="center"><label> <input type="submit" name="button" id="button" value="OK" /> </label></td> </tr> </table> </form> <?php } else { ?> <table width="99%" border="1"> <tr> <td width="90%" align="left">Categorias</td> <td colspan="2" align="center">Ação</td> </tr> <?php $sql = mysql_query ("SELECT * from categorias") or exit(mysql_error()); while ($coluna = mysql_fetch_array ($sql)) { ?> <tr> <td align="left"><?php echo $coluna[categoria] ?></td> <td width="5%"><a href="?acao=Alterar&id= <?php echo $coluna[id_categoria];?>"><img src="imagens/b_edit.gif" width="16" height="16" border = "0"/></a></td> <td width="5%"><img src="imagens/b_drop.gif" width="16" height="16" /></td> </tr> <?php } ?> <tr> <td colspan="3" align="right"><img src="imagens/b_insrow.gif" width="16" height="16" /><span style="font-size: 12px;">Inserir</span></td> </tr> </table> <?php } ?> <p> </p></td> </tr> </table></td> </tr> <tr> <td colspan="2"><?php include('rodape.php'); ?></td> </tr> </table> </body> </html>
cabecalho.php<table width="779" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="9%"> </td> <td width="25%"><img src="imagens/logo.jpg" width="156" height="89" /></td> <td width="59%"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="2"> </td> </tr> <tr> <td width="73%"> </td> <td width="27%"><img src="imagens/imagenadm.gif" width="169" height="40" /></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="33%"> login:</td> <td width="58%"><strong>Data:</strong><?php $dia_da_semana = array ("Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"); $num_dia = date (w); $dia_extenso = $dia_da_semana[$num_dia]; echo $dia_extenso.", ".date("d/m/Y");?> - <b> Hora: </b> <?php echo date("H:i"); ?> - <b> IP: </b> <?php echo getenv ("REMOTE_ADDR"); ?> </td> <td width="9%"> </td> </tr> </table></td> </tr> <tr> <td colspan="2"><img src="imagens/menu.gif" width="623" height="34" /></td> </tr> </table></td> <td width="7%"> </td> </tr> </table></td> </tr> <tr> <td> </td> </tr> </table>
menu.php<table width="200" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="32"> </td> <td width="131"></td> <td width="37"> </td> </tr> <tr> <td> </td> <td><table width="178" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="imagens/menuu.gif" width="183" height="39" /></td> </tr> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%"> <tr> <td width="11%" height="51"> </td> <td width="89%" align="left" valign="top"> <a href="categoria.php">Categorias </a> <br /> <a href="subcategoria.php">Sub Categorias </a><br /> <a href="produtos.php">Produtos </a><br /> <a href="clientes.php">Cliente </a><br /> </td> </tr> </table></td> </tr> </table></td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table>
conexao.php<?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_conexao = "localhost"; $database_conexao = "loja"; $username_conexao = "root"; $password_conexao = ""; $conexao = mysql_pconnect($hostname_conexao, $username_conexao, $password_conexao) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db( $database_conexao , $conexao ) or die( mysql_error() ); ?>
-
i aew Dimitrov adiciona isso na ultima linha do arquivo conexao.php e testa pra ver:
mysql_select_db( $database_conexao , $conexao ) or die( mysql_error() );
espero que ajude abraço!
Opa muito obrigado romerito
deu certo sim,mas você poderia me explicar porque tinha q colocar essa linha sendo q o banco já esta selecionado mais a cima??
valeu mesmo
-
Por favor me ajudem,estou com um problema serio,o erro
"Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\admin\categoria.php on line 51"
dai coloquei o "mysql_error" ele da "no database selected" só que ai ta a questao pois o include do conexão esta na pagina =/
o codigo é este:
categoria.php
<?php include "conexao.php" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <table width="750" border="0" align="center"> <tr> <td colspan="2"><?php include('cabecalho.php'); ?></td> </tr> <tr> <td width="200"><?php include('menu.php'); ?></td> <td width="583"><table width="100%" border="0"> <tr> <td> </td> </tr> <tr> <td align="center" style="font-size: 14px; text-align: center;"><p>categoria</p> <?php if ($acao != "") { $sql = mysql_query ("SELECT * from Categoria Where id_categoria = $id"); ?> <form id="form1" name="form1" method="post" action="<? echo $PHP_SELF ?>"> <table width="300" border="1" align="center" cellpadding="2"> <tr> <td width="143">Categoria</td> <td width="147"><label> <input name="txt_categoria" type="text" id="txt_categoria" size="35" /> </label></td> </tr> <tr> <td colspan="2" align="center"><label> <input type="submit" name="button" id="button" value="OK" /> </label></td> </tr> </table> </form> <?php } else { ?> <table width="99%" border="1"> <tr> <td width="90%">Categorias</td> <td colspan="2" align="center">Ação</td> </tr> <?php $sql = mysql_query ("SELECT * from categorias") or exit(mysql_error()); while ($coluna = mysql_fetch_array ($sql)) { ?> <tr> <td><?php echo $coluna[categoria] ?></td> <td width="5%"><img src="imagens/b_edit.gif" width="16" height="16" /></td> <td width="5%"><img src="imagens/b_drop.gif" width="16" height="16" /></td> </tr> <?php } ?> <tr> <td colspan="3" align="right"><img src="imagens/b_insrow.gif" width="16" height="16" /><span style="font-size: 12px;">Inserir</span></td> </tr> </table> <?php } ?> <p> </p></td> </tr> </table></td> </tr> <tr> <td colspan="2"><?php include('rodape.php'); ?></td> </tr> </table> </body> </html>
conexao.php<?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_conexao = "localhost"; $database_conexao = "loja"; $username_conexao = "root"; $password_conexao = ""; $conexao = mysql_pconnect($hostname_conexao, $username_conexao, $password_conexao) or trigger_error(mysql_error(),E_USER_ERROR); ?>
por favor alguém me da uma luz ai
=/
-
O erro é que você tem 2 heads na mesma pagina. Como fez na linha abaixo:
<td colspan="2"><?php include "cabecalho.php"; ?></td>
Fazendo isto que você fez é a mesma coisa de você fazer isto aqui:<td colspan="2"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>AUHhuahu</title> </head></td>
A função include() ou include "" do PHP serve para incluir um arquivo dentro de outro, se você vai usar um include dentro do body de uma página o arquivo incluido não pode ter <html>, <head>, <body> e etc
Brigado ai veio
deu certo
=D~
-
Dependendo do padrão de código que você definiu no menu preferências (se definiu) ele pode dar este erro também, clique em Commands>>>Aply Sourcer Format
Pelo print não há erros no entanto abaixo pode ter algo errado, por favor poste o código da página inteira para que possa analisar onde está o erro.
intao Norivan estou usando o CS4 e fica com essa tag amarela do <head> me ajude a resolver isso testa o codigo ai pra mim...obrigado ai
e esse Commands>>>Aply Sourcer Format que você disse não funcionou não
=/
obrigado
-
Dependendo do padrão de código que você definiu no menu preferências (se definiu) ele pode dar este erro também, clique em Commands>>>Aply Sourcer Format
Pelo print não há erros no entanto abaixo pode ter algo errado, por favor poste o código da página inteira para que possa analisar onde está o erro.
index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <table width="750" border="0" align="center"> <tr> <td colspan="2"><?php include "cabecalho.php"; ?></td> </tr> <tr> <td width="156" valign="top"><?php include "menu.php"; ?></td> <td width="584"> </td> </tr> <tr> <td colspan="2"><?php include "rodape.php"; ?></td> </tr> </table> </body> </html>
cabecalho.php<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>AUHhuahu</title> </head> <body> <table width="779" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="9%"> </td> <td width="25%"><img src="imagens/logo.jpg" width="156" height="89" /></td> <td width="59%"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="2"><img src="/imagens/logo.jpg" width="156" height="89" /></td> </tr> <tr> <td width="73%"> </td> <td width="27%"><img src="imagens/imagenadm.gif" width="169" height="40" /></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="38%"> login:</td> <td width="48%"><strong>Data:</strong><?php $dia_da_semana = array ("Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"); $num_dia = date (w); $dia_extenso = $dia_da_semana[$num_dia]; echo $dia_extenso.", ".date("d/m/Y");?> - <b> Hora: </b> <?php echo date("H:i"); ?> - <b> IP: </b> <?php echo getenv ("REMOTE_ADDR"); ?> </td> <td width="14%"> </td> </tr> </table></td> </tr> <tr> <td colspan="2"><img src="imagens/menu.gif" width="623" height="34" /></td> </tr> </table></td> <td width="7%"> </td> </tr> </table></td> </tr> <tr> <td> </td> </tr> </table> </body> </html>
brigado por inquanto ai Norivan
-
Cara... pela imagem tá correto sim, mas já verificou se esse </head> não se repete em algum lugar do documento... hm... o Dreamweaver não acusa o erro? Só fica amarelo e só? Tipo, clique nesse </head> amarelo, e olhe à onde ele se refere no código...
meio sem noção isso que eu falei né? rsrs... enfim, tente procurar saber se o dreamweaver diz o erro, se sim, poste, e se quiser, poste todo o código também!
Vlw
Matheus Matos
intao ele esta dando essa exclamação pelo cabecalho.php...dai aparece uma janelinha escrita "include ssi file" o que significa???
-
por favor o que significa esse erro?
Warning: include(cabecalho.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\admin\index.php on line 11
Warning: include() [function.include]: Failed opening 'cabecalho.php' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\admin\index.php on line 11
-
Cara... pela imagem tá correto sim, mas já verificou se esse </head> não se repete em algum lugar do documento... hm... o Dreamweaver não acusa o erro? Só fica amarelo e só? Tipo, clique nesse </head> amarelo, e olhe à onde ele se refere no código...
meio sem noção isso que eu falei né? rsrs... enfim, tente procurar saber se o dreamweaver diz o erro, se sim, poste, e se quiser, poste todo o código também!
Vlw
Matheus Matos
não ele não se repete...não ele não da erro...mas só não consigo editar a tabela
=/
-
alguém poderia me ajudar não sei porque ta aparecendo esse erro no dreamweaver...porque a tag </head> ta fechada normal...e se não sumir isso não consigo editar minha tabela...por favor me ajudem...
-
Rickayron, brigado ai mais não deu certo
mas mesmo assim valer
Tenta não usar <?= ... ?> ele pode confundir com XMLPra testar, troca "<?=$registro["nome"]?>" por "<?php echo $registro['nome']; ?>"
falou
já tentei veio não deu
=/
deixe me ver se entendi.. você quer mandar esses dados para a pagina index.php, sendo que a pagina que você esta esta inclusa na index .php é isso?<?php $sql= "SELECT nome FROM cliente order by nome"; $resultado = mysql_query($sql) or die ("não foi possível realizar a consulta, verifique a conexão"); While($registro=mysql_fetch_array($resultado)) { $nome=$registro['nome']; echo"<option >".$nome." </option>"; } mysql_free_result($resultado); ?>
sim
-
A questão é que não sei mais o que fazer estou começando a programar,por isso sei o basico,mas esta acontecendo o seguinte,não consigo passar as variaveis do php pro html,por exempo se utilizo elas com o echo ou print beleza vai normal,só que tipo preciso repassar elas pra um select e não pega,e não é só no select pois qualquer parte do html tipo assim <?=$registro["nome"]?> não pega =/,não sei oque acontece pois já instalei php,apache,mysql por parte,já instalei o xampp tb nada e agora to utilizando o wamp tb nada...
se alguém puder me de uma luz ai...
valeu
index.php
<html> <head> <title> PHP </title> </head> <body> <table width = "100%" border = "1" cellspacing = "0" cellpadding = "0"> <tr> <td> <table width = "100%" border = "1" cellspacing = "0" cellpadding = "0"> <tr> <td colspan="2">Cabeçalho</td> </tr> <tr> <td width ="20%"> <table width = "100%" border = "1" cellspacing = "0" cellpadding = "0"> <tr> <td>Menu de opçoes </td></tr> <tr> <td><a href="index.php?link=1">Home </a></td></tr> <tr> <td><a href="index.php?link=2">Inserir</a> </td></tr> <tr> <td><a href="index.php?link=3">Alterar</a> </td></tr> <tr> <td>Excluir </td></tr> <tr> <td>Consultar </td></tr> </table> </td> <td> <table width = "100%" border = "1" cellspacing = "0" cellpadding = "0"> <tr><td> <?php $link=$_GET["link"]; $pag[1]="home.php"; $pag[2]="formcliente.php"; $pag[3]="selecionaalterar.php"; if (!empty ($link)) { if (file_exists($pag[$link])) { include $pag[$link]; } } else { print "a pagina não foi encontrada"; } ?> </td></td> </table> </td> </tr> </table> </td> </tr> </table> </body> </html>
selecionaalterar.php<? include ("conexao.php");?> <html> <head> <title> TEste </title> </head> <body> <form name="alterar" method = "post" action ="index.php?link=3"> selecione um nome: <select name = "selecao" size "1" id="selecao" > <?php $sql= "SELECT nome FROM cliente order by nome"; $resultado = mysql_query($sql) or die ("não foi possível realizar a consulta, verifique a conexão"); While($registro=mysql_fetch_array($resultado)) { ?> <option > <?=$registro["nome"]?> </option> <?php } mysql_free_result($resultado); ?> </select> <input name="ok" type = "submit" value = "OK"> </form> </body> </html>
O resto do programa ta beleza...só não consigo fazer pegar variavel nenhuma no html
-
brigado ai sergio
mas mesmo assim não rolou
=/
-
minhas variaveis não aparecem na outra pagina :wacko:
ex.php
<FORM action="Prog13.php" method="post" > email:<input type = "text" name = "nome" size = "30" Maxlength = "30"> <br> endereço:<input type = "text" name = "endereco" size= "80" maxlength ="80"> <br> estado: <select size = "1" name = "estado"> <option value="UF" checked> UF </option> <option value="AC"> AC </option> <option value="AL"> AL </option> <option value="AM"> AM </option> <option value="AP"> AP </option> <option value="BA"> BA </option> <option value="CE"> CE </option> <option value="DF"> DF </option> <option value="ES"> ES </option> <option value="GO"> GO </option> <option value="MA"> MA </option> <option value="MG"> MG </option> <option value="MS"> MS </option> <option value="MT"> MT </option> <option value="PA"> PA </option> <option value="PB"> PB </option> <option value="PE"> PE </option> <option value="PI"> PI </option> <option value="PR"> PR </option> <option value="RJ"> RJ </option> <option value="RN"> RN </option> <option value="RS"> RS </option> <option value="RR"> RR </option> <option value="RO"> RO </option> <option value="RN"> RN </option> <option value="SC"> SC </option> <option value="SE"> SE </option> <option value="SP"> SP </option> <option value="TO"> TO </option> </select><br> sexo: <br> <input type="Radio" name="sexo" value = "Masculino" > Masculino <input type="Radio" name="sexo" value = "Feminino"> Feminino <br> profissão: <select size = "1" name = "profissao"> <option value="programador"> programador </option> <option value="designer"> Designer </option> <option value="engenheiro"> engenheiro </option> <option value="médico"> médico </option> </select><br> <input type ="submit" value = "enviar"> <input type ="reset" value = "limpar">
Prog13.php<HTML> <HEAD> <TITLE> Teste </TITLE> <HEAD> <BODY> <?php $nome = $_POST["nome"]; $endereco =$_POST["endereco"]; $estado =$_POST["estado"]; $sexo =$_POST["sexo"]; $profissao =$_POST["profissao"]; $opt1 =$_POST["opt1"]; $opt2 =$_POST["opt2"]; $opt3 =$_POST["opt3"]; $opt4 =$_POST["opt4"]; $opt5 =$_POST["opt5"]; ?> Nome: -------------- <?=$nome?><br> Endereço: ---------- <?=$endereco?><br> Estado: -------------<?=$estado?><br> Sexo: ===============<?=$sexo?><br> profissão: ===============<?=$profissao?><br> </BODY> </HTML>
me ajudem ai fazendo um favor...
-
Olha sinceramente nunca consegui fazer o wamp rodar na minha máquina, quer dizer em nenhuma que já tentei: winxp sp3 e vista.
Desisti dele e instalei o Xampp e por incrivel que pareça instalou de primeira em ambas as máquinas e roda 100%.
tenta o xampp.
eu tambem nunca conseguir roda´-lo aconselho voce a usar o easy-php, xampp, ou instalar o php e apache, o php e o iis tambem fica bacana no xp
Opa brigado ai
instalei tudo dinovo e funcionou
valeu ai
:rolleyes:
-
Estou com problema e não consigo resolver,tenho instalado o wamp no meu pc,já instalei manualmente tambem o php,o apache,e o banco de dados.Mas o que acontece é que o GET e o POST do FORM não funcionam em Localhost,pois já testei o codigo no servidor da web funcionou normal,se der pra alguém me der uma luz ai,já ativei e desativei tambem o register globals e nada
:wacko:
Formulario...
<form name="cadastro" method="post" action="testes.php"> <b>Escolha sua linguagem favorita:</b><br> <select name="linguagem"> <option value="Java" selected>Java</option> <option value="C++">C++</option> <option value="Python">Python</option> <option value="Delphi">Delphi</option> </select> <input type="submit" value="Enviar!"> </form>
Recebimento...<? // Obtém o valor selecionado $selecionada = $_POST["linguagem"]; // Exibe o resultado echo "Sua linguagem favorita é: " . $selecionada; ?>
Problema no update mysql
em PHP
Postado
verdade copie errado
o alterar ta ai...
<a href="?acao=Alterar&id= <?php echo $coluna[id_categoria] ;?>"><img src="imagens/b_edit.gif" width="16" height="16" border = "0"/></a>
valeu