Ir ao conteúdo
  • Cadastre-se

Telmo Junior

Membro Júnior
  • Posts

    6
  • Cadastrado em

  • Última visita

posts postados por Telmo Junior

  1. Tá ai o código funcionando certinho para quem precisar,

    Moderador pode fechar como Resolvido

     

    valeu

    <?phpsession_start();if(!$_SESSION['us_logado']){echo '<script>';print 'location.href="logout.php"';echo '</script>';}?><!doctype html><link rel="stylesheet" type="text/css"href="estile.css"><style type="text/css">a:link {color: #312E2E;text-decoration: none;}</style><link href="jQueryAssets/jquery.ui.core.min.css" rel="stylesheet" type="text/css" /><link href="jQueryAssets/jquery.ui.theme.min.css" rel="stylesheet" type="text/css" /><link href="jQueryAssets/jquery.ui.button.min.css" rel="stylesheet" type="text/css" /><style type="text/css">body {background-color: #ECECEC;}</style><!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"><html><script src="jQueryAssets/jquery-1.8.3.min.js" type="text/javascript"></script><script src="jQueryAssets/jquery-ui-1.9.2.button.custom.min.js" type="text/javascript"></script><head><meta charset="iso-8859-1"><!--[if lte IE 7]><link rel="stylesheet" type="text/css" title='Main' media="screen" href="http://www.scriptbrasil.com.br/forum/public/style_css/css_1/ipb_ie.css"/><![endif]--><?phpfunction ifChecked($obj){if($obj <> '' || !empty($obj)){return 'checked';} else {return '';}}$host = 'localhost'; // endereço do seu mysql$user = 'usuario'; // usuário$pass = 'senha'; // senha$con = mysql_connect($host,$user,$pass); // função de conexão$db = 'banco'; // nome do banco de dadosmysql_select_db($db,$con) or print mysql_error(); // seleção do banco de dados?><title>Ramais Plastilit</title></head><div id="tudo" align="center"><div id="site"><div id="topo"></div><!--fim topo--><div id="botao"></div><!--fim botao--><div id="meio"><div id="conteudo"><h1><font style='font-weight:bold;'>Alterar dados de Funcionário</font></h1><br /><br /><?Php error_reporting (E_ALL ^ E_NOTICE); ?><form method="post" action="home.php"><font style='font-weight:bold;'>Selecione a Filial: </font><select name="filial" id="filial"><option value="#" > Todos </option><option value="cwb" > Curitiba </option><option value="frg" > Fazenda Rio Grande </option><option value="plm" > Palmeira </option></select><input type="text" name="busca" size="35" /><input type="submit" value="Busca" id="btnBusca" /></form><br /><br /><?phpif($_GET['action']=='edit'){$action = 'update.php?id=' . $_GET['id'];$sql = "select * from banco where id = " . $_GET['id'];$result = mysql_query($sql);$_row=mysql_fetch_array($result);} else {$action = 'insert.php';}?><form id="form1" name="form1" method="post" action="<?php echo $action; ?>" onSubmit="return validateForm();"><table width="200" border="1"><tr><td><font style='font-weight:bold;'>Nome</font></td><td><label for="nome"></label><input type="text" name="nome" id="nome" value="<?php echo $_row['nome']; ?>" /></td></tr><tr><td><font style='font-weight:bold;'>Ramal</font></td><td><label for="ramal"></label><input type="text" name="ramal" id="ramal" value="<?php echo $_row['ramal']; ?>" /></td></tr><tr><td><font style='font-weight:bold;'>Email</font></td><td><label for="email"></label><input type="text" name="email" id="email" value="<?php echo $_row['email']; ?>" /></td></tr><tr><td><font style='font-weight:bold;'>Dominio</font></td><td><label for="dominio"></label><input type="text" name="dominio" id="dominio" value="<?php echo $_row['dominio']; ?>" /></td></tr><tr><td><font style='font-weight:bold;'>Celular</font></td><td><label for="celular"></label><input type="text" name="celular" id="celular" value="<?php echo $_row['celular']; ?>" /></td></tr><tr><td><font style='font-weight:bold;'>Setor</font></td><td><label for="setor"></label><input type="text" name="setor" id="setor" value="<?php echo $_row['setor']; ?>" /></td></tr><tr><td><font style='font-weight:bold;'>Filial</font></td><td><label for="filial"></label><input type="text" name="filial" id="filial" value="<?php echo $_row['filial']; ?>" /></td></tr></table><br /><input type="submit" name="submit" id="submit" value="Enviar" /></form><br /><p id="errorMessage" style="color:#C00; font-style:italic;"></p><?phpswitch($_POST['filial']){case 'cwb':$SqlWhere = " and filial = 'Curitiba'";break;case 'frg':$SqlWhere = " and filial = 'Fazenda Rio Grande'";break;case 'plm':$SqlWhere = " and filial = 'Palmeira'";break;default:$SqlWhere = '';}$sqlBusca = "SELECT * FROM banco WHERE nome LIKE '$_POST[busca]%' $SqlWhere ORDER by nome";$result = mysql_query("$sqlBusca");echo "<table border='2'>";echo "<tr><th>nome</th><th>ramal</th><th>email</th><th>dominio</th><th>celular</th><th>setor</th><th>filial</th><th colspan=\"2\">Ação</th></tr>";while($row=mysql_fetch_array($result)){ echo "<tr onmouseover=\"#FFF\" onmouseout=\"#000\">";$idn=$row['id'];$no=$row['nome'];$ra=$row['ramal'];$em=$row['email'];$do=$row['dominio'];$ce=$row['celular'];$se=$row['setor'];$fi=$row['filial'];echo "<td>".$row['nome']." </td>";echo "<td>".$row['ramal']."</td>";echo "<td>".$row['email']."</td>";echo "<td>".$row['dominio']."</td>";echo "<td>".$row['celular']."</td>";echo "<td>".$row['setor']."</td>";echo "<td>".$row['filial']."</td>";echo "<td><a href='delete.php?id=$idn'><font color='red'>Delete</a></td>";// <td><a href='home.php?id=$idn&action=edit&no=$no&ra=$ra&em=$em&do=$do&ce=$ce&se=$se&fi=$fi'><font color='green'>Editar</a></td>";echo "<td><a href='home.php?id=$idn&action=edit'><font color='green'>Editar</a></td>";echo "</tr>";}echo "</table>";?><br /><a href="logout.php"><button id="Button">sair</button></a>  <a href="menu.php"><button id="Button">voltar</button></div><!--fim conteudo--><div id="robocon2"></div><!--fim robocon--></div><!--fim meio--><div id="rodape"></div><!--fim rodape--></div><!--fim site--></div><!--div id tudo--><script type="text/javascript">$(function() {$( "#Button1" ).button();});</script></body></html>
  2. Bom dia

     

    Estou enfrentando o problema a seguir

     

    Busquei o seguinte código para gerar uma tabela do excel buscando dados do Banco

    <?php // Inclui a conexão include_once('conn2.php'); // Nome do Arquivo do Excel que será gerado $arquivo = 'Lista_Ramais.xls'; // Criamos uma tabela HTML com o formato da planilha para excel $tabela = '<table border="1">'; $tabela .= '<tr>'; $tabela .= '<td colspan="2">Filial</tr>'; $tabela .= '</tr>'; $tabela .= '<tr>'; $tabela .= '<td><b>Nome</b></td>'; $tabela .= '<td><b>Ramal</b></td>'; $tabela .= '<td><b>Setor</b></td>'; $tabela .= '</tr>'; // Puxando dados do Banco de dados $resultado = mysql_query('SELECT * FROM banco'); while($dados = mysql_fetch_array($resultado)) {  $tabela .= '<tr>';  $tabela .= '<td>'.$dados['nome'].'</td>';  $tabela .= '<td>'.$dados['ramal'].'</td>';      $tabela .= '<td>'.$dados['setor'].'</td>';  $tabela .= '</tr>'; } $tabela .= '</table>'; // Força o Download do Arquivo Gerado header ('Cache-Control: no-cache, must-revalidate'); header ('Pragma: no-cache'); header('Content-Type: application/x-msexcel'); header ("Content-Disposition: attachment; filename=\"{$arquivo}\""); echo $tabela;?>

    Até ai beleza Gera tudo certinho e tal

    agora que começa o problema, esta planilha busca todos os dados do banco como eu quero mas gera o resultado a baixo, eu gostaria que ao chegar no limite de exibição de 28 linhas ele exiba ao lado

     

    Exemplo

     

    titulo 1 titulo 2  titulo 1  titulo 2

    a          1           d           4

    b          2           e           5

    c          3           f            6

     

     

     

    e assim vai, pois preciso imprimir este resultado em apenas uma folha

     

    Alguém pode me ajudar?

  3. Boa Tarde

     

    Estou precisando de uma ajuda urgente

    Criei um sistema de lista de ramais eletrônico, está rodando tudo uma beleza

    Cadastro o funcionário ramal e-mail setor filial etc.

    estou quebrando a cabeça para editar estes dados já inseridos no banco MySQL

    queria buscar o usuário em uma pesquisa e ao lado do resultado aparecer a opção de editar.

    Exemplo

     

    Nome:                     Ramal:

    Fulano (editar)        4180 (editar)

     

    Constatei que existem vários códigos na internet, mas nenhum realmente funciona, ou se funcionam não consigo traduzi-lo para minha pagina

     

    Segue meu código de busca

     

    <link rel="stylesheet" type="text/css"href="teste.css" /><div class="tudo">   <div class="topo"><img src="Imagens/fundo-ramais-2_01.jpg" width="1600" height="169" alt=""/></div>   <div class="conteudo">    <div><a href="index.html">Sair</a></div><meta charset="utf-8"><form method="POST" action="busca.php"><input type="text" name="busca" size="35">     <input type="submit" value="Busca" name="ok"></form><table width="100%" border="2" cellspacing="0" cellpadding="0" bordercolor="#E5AE0D">  <tbody>    <tr>      <th style="font-size: 14px; color: #363636;" scope="col">Nome:</th>      <th style="font-size: 14px" scope="col">Ramal:</th>      <th style="font-size: 14px" scope="col">E-Mail</th>      <th style="font-size: 14px" scope="col">Celular</th>      <th style="font-size: 14px" scope="col">Setor</th>      <th style="font-size: 14px" scope="col">Filial</th>    </tr>    <tr><?php$host = 'localhost'; // endereço do seu mysql$user = 'tuser'; // usuário$pass = ' '; // senha$con = mysql_connect($host,$user,$pass); // função de conexão$db = 'banco'; // nome do banco de dadosmysql_select_db($db,$con) or print mysql_error(); // seleção do banco de dados$busca=$_POST['busca'];$sql = mysql_query("SELECT * FROM banco WHERE nome LIKE '%$busca%' OR ramal LIKE '%$busca%' OR email LIKE '%$busca%' OR setor LIKE '%$busca%' OR filial LIKE '%$busca%'");// query para selecionar todos os campos da tabela usuários se $busca contiver na coluna nome ou na coluna email// % antes e depois de $busca serve para indicar que $busca por ser apenas parte da palavra ou frase// $busca é a variável que foi enviada pelo nosso formulário da página anterior$count = mysql_num_rows($sql);// conta quantos registros encontrados com a nossa especificaçãoif ($count == 0) {    echo "Nenhum resultado!";} else {    // senão    if ($count == 1) {        echo "1 resultado encontrado!<br><br><br>";    }    // se houver um resultado diz que existe um resultado    if ($count > 1) {        echo "$count resultados encontrados!";    }    // se houver mais de um resultado diz quantos resultados existem    while ($dados = mysql_fetch_array($sql)) {   echo "<tr>\n";   echo "<td>" . $dados['nome'] . "</td>\n";   echo "<td>" . $dados['ramal']."</td>\n";   echo "<td>" . "<a href=mailto:".$dados['email'].$dados['dominio'].">" . $dados['email'].$dados['dominio'] . "</td>\n";   echo "<td>" . $dados['Celular']."</td>\n";   echo "<td>" . $dados['Setor']."</td>\n";   echo "<td>" . $dados['filial']."</td>\n";   echo "</tr>\n";}echo "</table>\n"; }?>   </tr>  </tbody></table></div>   <div class="rodape"><img src="Imagens/fundo-ramais-2_03.jpg" width="1600" height="74" alt=""/></div></div>
     
     
     
     
     
     
    Se alguém puder me ajudar agradeço

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

Ebook grátis: Aprenda a ler resistores e capacitores!

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!