PH
limpa lixeira? cmd.exe /c "PowerShell.exe -NoProfile -Command Clear-RecycleBin -Force"- ipconfig/flushdns - 1-botao <Sair> Botao direito na Area trabalho, Atalho, escreva o Comando:-> Shutdown.exe -s -t 00 2- Destivar o oneDriver prompt command adm “%SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall”
Saber ser ativado prompt Comando: slmgr /xpr
Ativa -2.Jeit
- Power S- Comando: irm https://get.activated.win | iex
E ESCOLHA 1 -DUAS VEZES E ATIVARA
POWERSHEEL C/ ADMIN---COMAND EXECT SCRIPT
Set-ExecutionPolicy Unrestricted
****
descobrir IP do site 4 forma descobrir provedor esta o site outras formas descobrir o registo
A
01A-ANTIVIRuS
irm https://get.activated.win | iex
1-Avira
Antvirus
2-Panda
3-Avast
Avast Ch
Avast Leve Pers
C
2 -Compactadores
Wrar 42
AnyDesk
not.pad
Winrar
7 Zip
Cleano
LimpAr Win
Ative w-11, va Em pesquisa do window, bote power shel, c/botao direto s/ele, executar como admin
1-) Cole este comando
irm https://massgrave.dev/get | iex
2-) tecle enter, esolha em seguida opcao 1
apos ativar, tecle 0 para sair
N
4 - Navegadores
Bx.Chrome
1-Avast br
2-Chrome
3-FireFox
4-Opera
5-Brava
6-Edge
Exprtar Favorito
Pagina.ini.nav
Chrome
chrom rap
instalar Firefox com power shell Comando : winget install --id=9nzvdkpmr9rd
Loja Micro
Free Downlo
Programas Essencial
PACK POS Formatar
Brava Chrome Rapid
Brave
Driver hub
S.OS
Brava Rap.
+ Desempenho
FireMin bx cons.Mem Navegador
Naveg c/ FIREMIN
BX Cons.Mem Chrome
Bx.Ninite
Video.Ninite
O
6 Otimizador Microsoft Pc-manager e Wintoys
Pc-Manager
Quickbost
Bx.winScript 1.4.2
Video-1 winScript 1.4.2
Video-2 winScript 1.4.2
Wintoys
QuickBoost
Prg.Exencial
1-Ventoy
bx 2-Ventoy
bx 3-Rufus Pen Boot
debloater
Video-debloater
Debloat video :
Video-debloater Cris
irm "https://christitus.com/win" | iex
Formatar ssd p/cmd: 1- diskpart 2- list disk 3- select disk 1 4- clean 5-convert gpt 5A-create partition primary
6- format fs= ntfs quick 7-assign (cria uma letra)
P
7- Leitor de Pdf
-Sumatra
DoPdf impressora virtual
Video Sumatra
DoPdf
-Sumatra
08- SUPORTE REMOTO
FILEZZILA
-Sup.Remoto Anydesk
Video1 Remoto Anydesk Video2 Remoto Anydesk
08-TODOS DRIVES
-3dp drive
video 3dp dr
Video Revo Revo-Unis Geek
Geek Unistall
PrimoCache
Limpa
06-Office PC
Free Ofice
Office 2007 pass MANGA321 KGFVY-7733B-8WCK9-KTG64-BC7D8
Offic
LibreOffice LibreOffice = Video de instalar o liberOffice FreeOffice FrrePdf
06-a Services para desativar PC
1- Configuração da Área de Trabalho Remota
2 Controle dos Pais
3 Diagnostic Execution Service
4 Experiência de Usuários Conectado e Telemetria
5 Gerenciador de Autenticação Xbox Live
6 Gerenciador de Conexão de Acesso Remoto
7 Logon de Rede
8 Logs e alertas de desempenho
9 Pastas de Trabalho
10 Politica de Remoção de Cartão Inteligente
11 Registro Remoto
12 Salvar Jogos no Xbox Live
13 Serviço de Biometria do Windows
14 Serviço de Criptografia de Unidade de Disco BitLocker
15 Serviço de Enumeração de Dispositivo de Cartão Inteligente
16 Serviço de Geolocalização
17 Serviço de Hotspot Móvel do Windows
18 Serviço de Rede Xbox Live
19 Serviço de Relatório de Erro do Windows
20 Serviço de Sensor
21 Serviço de Suporte a Bluethooth
22 Serviço de Telefonia
23 Serviço de Avaliação de Inventário e Compatibilidade
24 Spooler de Impressão
25 SysMain
26 Telefonia
27 Xbox Acessory Management Ser
07-TODOS DRIVES
-3dp drive
video 3dp dr
Limpar
Drive Hub
Video Drv.Hub
Cleano
08-Ativar Win -Comando se esta Valido---Slmgr.vbs /xpr
Ativa Win
Bx Win
No Update
Dism+
09 - VLC Media Player
VLC Media Player 32 Bits = https://goo.gl/M4fiQS
VLC Media Player 64 Bits = https://goo.gl/Ank6id
Para a versão 64 Bits ao lado do link Baixar VLC , Clica na seta para aparecer.
Menu fixo - Como fazer um blog do zero #4
Mais Ninite.com
Tela azul win
Dica Php
Baixe Video
Crud c/Foto
Crud
Edit TextArea
Tdas Tags
Drive
FreeMom
Modal erro
Alertc/Icon
Pdo
FreeMom
Ideone Php
Sandbox Php
Write Php
Tester Php
Server Php
Edit php
Temp
Menu Resp
Modal
Agendar
Crud Pdo
Sistema O.Serv
Os.
Cod
Inner join
Navi bar
Cor fieldset
Cod.Php
Note+Func
Modal Centralizad
Pergunt modal
Crud Modal
Input
Modal bootstrap 5
Modal Qt
Date Table
Edit Modal
Cadast.Modal
Exec.Php
Cod.Cliente
Crud login
Boots-Modal
Alert
Fpdf
Cores
Dt Automatic
Ajax Requis.
Alert jquery
phreeze
phreeze
Ajax PHP
O.S
G.pdf
Inner join
Concatenar
Inner join
php
Pix E/Boleto
Fillcolor
Dominio
Pdo Mysqli
*
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
*****-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="css/bootstrap.css" rel="stylesheet" type="text/css">
*****
<button class="btn btn-primary" onclick="window.open('https://www.google.com.br/', '_blank');" style="font-size: 12px; font-weight: bold;">Goo</button>
***
V Modal php Link Modal Cor PALHET Form bootstrap
Cor Botton
Client
Venda
Crud DataTable
VEnDA PH
Crud-1
Crud 2
Crud 3
Crud 4
Mtos Crud
Cod-77
Asoscoa
Gera/Maestro
Link
Fre Host
Crud5
Crud pdo
Crud Foto
NAVIBAR C/BOOTSTRAP
Email
Edit Php
Alert
Crud6
Vendas
Site.Php Grati
Sqlite php
php Ticket
Crud 8
Cod.crud 8
Cvs php
crud 7
Cod.crud-7
Crud 19
Crud 20
Crud 21
Crud9
Crud
Mapo
Mapo
Mapo
php blog
Cod Crud 10
Crud
Ms Xml
ConverTe p/PDO Link De 1 COPIA antes DE Converte
Tutorial de paginação com Bootstrap Zero bugs
Ctrl+U, Ctrl+a, Ctrl+c
DATEPICTURE BOOTSTRAP
maxlength="100" maximo de digitos size="100"
autofocus da o focu no primeiro camo do formulario required="required"
update sites set obs1='instrumental' WHERE obs1="Classic" and tipo=9
Supondo que tenha esse html:
<form method ="post" action ="page.php" >
<input type ="text" name ="foo" value ="foo" disabled ="disabled" />
<input type ="text" name ="bar" value ="bar" readonly ="readonly" />
</form >
Sua página 'page.php' irá receber apenas o $_POST['bar']
echo '<tr class="active">'; ou echo '<tr class="info">';
<div class='container'>
<div class="panel panel-default">
<a href="#" class="btn btn-info"><span class="glyphicon glyphicon-pencil"></span>Edit</a>
<div class = "iconInput" >
<i class = "glyphicon glyphicon-file" ></i>
<input type = "text" class = "form-control" placeholder = "Nome do arquivo" />
</div>
<html lang="pt-BR"> <h3 align="center">Alterar </h3>
<div class="modal-content"> <div class="modal-header">
------------****
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
*****************************-
SELECT id
,title
,description
,city
,created
FROM budget
WHERE created BETWEEN TO_DATE('01/01/2019' , 'dd/mm/yyyy' )
AND TO_DATE('30/12/2019' ,'dd/mm/yyyy' )
GROUP BY budget.city, budget.id
ORDER BY budget.created, budget.city ASC
Exemplo campo obrigatorio required input field:
Deletar , na tabela a OS ID menor que 7 === DELETE FROM os4s1 WHERE id<7
e para enviar para morto
insert into morto select * from os1 WHERE id<6890 ;
e para excluir na sequencia DELETE FROM os1 WHERE id<6890;
$select = $_POST['nome_do_select'];
//**************************************************
<a href="javascript:nova('https://www.google.com' '_blank')">Clique p/ abrir</a>
<script>
function nova (URL){
window.open(URL,"janela1","width=800, height=600, directories=no, location=no, menubar=no,scrollbars=no, status=no, toolbar=no, resizable=no")
}
</script>
**********************
update sites set obs1 = "Nacional" where obs1 = ""
SELECT * FROM sites where left(usuario,5)="Power"
update sites set tipo=0 where trim(obs1)="Italianas"
SELECT *
FROM `lc_movimento` order by 'dia' ,
'mes' DESC /* MENU FIXO no blog css Link
---------------------------------------*/
#menufixo {
font-family: tahoma;
background:#2E64FE;
height: 40px;
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 99;
}
5<title>HTML5 – Estrutura básica</title>
update tenants set email="1@yahoo.com.br", senha =md5("123") where id=2
update agenda set cidade="SANTO ANDRE" where LEFT(CIDADE,10)="SANTO ANDR" and id=2
update sites set obs1="Internacional" where LEFT(obs1,5)="Inter"
if ($sql->rowCount() > 0) {
rowCount() <=1
INSERT INTO `agenda` (`id`, `nome`) VALUES (102,'BANOVE ESXPRESS AVISTA')
se Inclui ou alterou if($result && $db->affected_rows() === 1): ************** <div style ="border: 2px solid;text-align:right" class ="row" >
<a class ='btn btn-link' href ='#' > <h3 > back</h3 > </a >
</div > *********************************************
<SCRIPT LANGUAGE="JavaScript">
// Script para fins educacionais - Não utilize profissionalmente
function Login(){var done=0;var usuario=document.login.usuario.value;var senha=document.login.senha.value;
if (usuario=="giane" && senha=="31759") { window.location="https://www.google.com.br"; done=1; }
if (usuario=="pedro" && senha=="7742") { window.location="https://musicalceu.blogspot.com//"; done=1; }
if (done==0) { alert("Senha ou Usuário inválido."); }}</SCRIPT>
<center><form name=login><table border=1><tr><td><center>LOGIN BLOGGER</center></td></tr><tr><td><input type='text' name='usuario' /></td></tr><tr><td><input type='password' name='senha' /></td></tr><tr><td><input type=button value="Entrar" onClick="Login()"></td></tr></table></form></center>
echo "<script>alert('Email enviado! ' );location.href=" index.php" ;</script>" ; print "<script>alert('Edicao c/Exito!');location='index.php';</script>"; ** ou echo "<script>alert('Usuario ou senha esta errada !! ');</script>";
echo '<meta http-equiv="refresh" content="0; url=mando.php"'; <input type="button" class="botao" onclick="window.location.href='https://www.google.com.br';" value="Goog"/> <script language="JavaScript">
window.onbeforeunload = confirmExit;
function confirmExit()
{
return "Se vc fechar o navegador, seus dados serão perdidos. Deseja Realmente sair?";
}
</script> <button type="button" onclick="location.href = 'menu.php';">Sair</button> <th width="2%" ><a class="btn btn-danger btn-xs" type="button" onclick="location.href = 'menu.php';">Sai</a></th> confirmar Deseja Sair? <button style="font-size: 10px;" class="btn-info" onclick="confirmar();">Sair</button>
<div id="dialog-confirm" title="Voce deseja Sair ?"></div> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
<script type='text/javascript'>
function confirmar() {
$( "#dialog-confirm" ).dialog({
resizable: false,
height: "auto",
width: 400,
modal: true,
buttons: {
"Sim": function () {
location="exit.php?logout";
$(this).dialog('close');
},
"Nao": function() {
$( this ).dialog( "close" );
console.log('cancelado');
}
}
});
}
</script > msg desucesso jquery <!DOCTYPE html>
<html>
<head>
<title> msg de sucesso jquery </title>
<meta charset="utf-8">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
</head>
<body>
<div id="msgExcluir">
Atualizado com Exito ?
</div>
<script type='text/javascript'>
var msgExcluir = $("#msgExcluir");
msgExcluir.dialog({
modal: true,
buttons: {
"ok": function () {
$(this).dialog('close');
}
}
});
</script >
</body>
</html>
aletra 2 com quebra <?php
$materia=" Informe os dados CORRETAMENTE !! ";
echo "<script type='text/javascript'>alert(' AVISO !!!\\n BOTE OS DADOS DA TUA EMPRESA\\n $materia\\n PARA NAO TER problemas! ');</script>";
?> <!doctype html> ALERT COM JQUE
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.13.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script src="https://code.jquery.com/ui/1.13.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#dialog" ).dialog();
} );
</script>
</head>
<body>
<div id="dialog" title="AVISO">
<p>GRAVADP COM SUCESSO PARA FECHAR CLCK NO 'x' icon.</p>
</div>
</body>
</html> <?php
include('conexion1.php');
$id=$_POST['id'];
$cantidad=$_POST['cantidad'];
$query= "SELECT * FROM productos WHERE Id_p=$id" ;
$consulta =mysqli_query($conexion ,$query) ;
if(mysqli_num_rows($consulta) <=0){
echo "<script type= 'text/javascript'>alert('nao achou !');
window.location.replace('ventas.php');</script>";
}
?> // ***select nao encontrou nada <div class="form-group">
<label font-size: 11px; >data INGRESO </label>
<input type="date" value="<?php echo date("Y-m-d");?>" name="FechaIngreso" size="10" class="pfinput" >
</div> // iniciar com a data atual verifica se huve alteracao na tabela if(mysqli_affected_rows($con) > 0){
echo "<script type='text/javascript'>alert('Gravei s fatira c/Exito ');</script>" ;
echo '<meta http-equiv="refresh" content="0; url=clientes.php"';
} else {
echo "<script type='text/javascript'>alert('Error:ao Incluir " . $sql . "<br>" . $conn->error."');</script>";
} <script type='text/javascript'>
function logout() {
var choose = confirm("Deseja realmente sair?");
if (choose == true) {
location="Main.html";
} else {
}
</script >
<nav id="menuOp">
<a href="javascript:logout()">Log Out</a></br>
<b>Olá, #</b>
</nav> COR FIELDSET <fieldset style="background-color: #ededff ; color:#FFFFF; font-size: 12px;" > PERGUTA AO SAIR ? S/M <li><a href="login.php?logout" " onclick="return confirm(' Sair ?');" ><i class='glyphicon glyphicon-off'></i> Sair</a></li> ALERT echo "<script type='text/javascript'>alert('Incluso c/Exito ');</script>"; se acha registro num $link = $this - > db_connection ( ) ;
$pass = $_POST [ 'user_password' ] ;
$user = $_POST [ 'user_name' ] ;
$query = "SELECT password, user_type, name FROM user WHERE user_name='{ $user } '" ;
$result = mysqli_query ( $link , $query ) or die ( mysqli_error ( $link ) ) ;
if ( mysqli_num_rows ( $result ) == 1 ) {
echo "<script type='text/javascript'>alert('acchoy Reg ');</script>"; $result = mysqli_fetch_array ( $result ) ; CAMPO enum('m','f') DEFAULT NULL , NA TABELA CLIENTES <html lang="pt-BR"> <div lang="pt-BR"></div> <input style="font-size: 17px;" type="button" class="botao" onclick="window.location.href='https://www.google.com.br';" value="Google" /> affected_rows() em pdo ficara assim sem encontrou registros na select * from cbo if ($results->rowCount()){
while($row = $results->fetch(PDO::FETCH_ASSOC))
{
?>
</tr>
<td><?php echo $row["id"]; ?></td>
<td><?php echo $row["descricao"]; ?></td>
<td><?= date('d/m/Y', strtotime($row['data'])) ?></td>
<td><?php echo $row["categoria"]; ?></td>
<?php
if ($row["tipo"]== 1){
$tipo ='A Pagar';
$w_valor1 =$w_valor1 +$row['valor'];
} else {
$tipo ='A Receber';
$w_valor2 =$w_valor2 +$row['valor'];
}
?>
<td><?php echo $tipo; ?></td>
<td>R$ <?= number_format($row['valor'],2, ',', '.') ?></td>
<?php
if ($row["status"]== 1){
$status ='Pago';
} else {
$status ='nao Pago';
}
?>
<td><?php echo $status; ?></td>
</tr>
<?php
}
} else{
echo "<script type='text/javascript'>alert('nao achei dados ');</script>";
}
}
?>
</tbody>
</table>
if($result && $db->affected_rows() === 1):
SELECT COM OPTIO PEGAR O NOME DO FORNECEDOR
<select name="id_for" class="form-control" style="margin-bottom:20px;">
<?php
while ($row = $res->fetch_assoc()) {
echo " <option value=".$row['id'].">".$row['nome']."</option>";
}
?>
</select>
CREATE TABLE IF NOT EXISTS `tipo_produto` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tipo` varchar(55) NOT NULL,
`descricao` varchar(55) default NULL,
`status` int(1) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;
$servidor = "localhost";
$usuario = "root";
$senha = "";
$dbname = "celke";
//Criar a conexao
$conn = mysqli_connect($servidor, $usuario, $senha, $dbname)
or die("NAO ACHE O USUARIO DO BCO"); ;
<link <link rel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
TEXT FNAO EDITAVEL DISABLED
<input type = "text" placeholder = "Apenas Disabled" disabled >
<button class="btn btn-default glyphicon glyphicon-search">Buscar</button>
autofocus required="required" data-error="DB Pass is required *"
background: url("../img/pd.jpg") fixed;
echo "<script type='text/javascript'>alert('Nao Gravei ');</script>" ; ****
update `os1` set km=1 WHERE trim(km)=0
update 'produtos' set saldo = 0 where saldo is nul
update `os1` set destino1=trim(endereco) WHERE right(data,4)='2017'
echo "<script>alert('Dados gravados com sucesso !')</script> \n <script>setTimeout('window.close()', 3000);</script>";
Qdo Input não é Editavel readonly="readonly"
autofocus required
pull-right
class="btn btn-success pull-left" align="left"
<h3 align="center">Alterar </h3>
style="font-size: 18px;" "background-color: #E9ECF5"
*************************************
<div class="modal-content">
<div class="modal-header">
<form class="form-horizontal">
<fieldset>
<!-- Form Name -->
<legend>Cadastro de Clientes</legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Nome :</label>
<div class="col-md-5">
<input id="textinput" name="textinput" type="text" placeholder="bote o nome " class="form-control input-md" required="">
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="cancel">cancel</label>
<div class="col-md-4">
<button id="cancel" name="cancel" class="btn btn-primary">cancel</button>
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="Gravar">Gravar</label>
<div class="col-md-4">
<button id="Gravar" name="Gravar" class="btn btn-danger" pull-left>grave</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
*******************
< form action="/action_page.php" >
Username: < input type ="text" name ="usrname" autofocus placeholder="Seu nome" required >
< input type="submit" >
< /form>
echo '<script type="text/javascript">
alert("foi adicionado !");
window.location.href="/scriptagenda/paginas/clientes.php";
</script>';
ou
echo "<script>alert('alterou e gravo');</script>";
echo "<meta http-equiv=refresh content=\"180;URL=script.php\">";
Paginacao em Php
<input type="submit" name="buscacep();" value="Busca" />
<!-- -->
// dados conexão
$mysqli = new mysqli('
127.0.0.1:3307 ', 'root', 'root', 'curso_php_cadastro');
// Check erros
if ( $mysqli->connect_errno )
{
echo $mysqli->connect_errno, ' ', $mysqli->connect_error;
}
// SQL query
$sql = "select id, destino, valor, vr_moto, vr_expr, vr_hora, data from preco";
// Printing results
$result = $mysqli->query( $sql );
// cria array
$arrayPreco = array();
***NESTA SELECT OPTION COMBO-TRAZ O NOME DO FORNECEDOR
<select name="id_for" class="form-control" style="margin-bottom:20px;">
<?php
while ($row = $res->fetch_assoc()) {
echo "
<option value=".$row['id'].">".$row['nome']."</option>";
}
?>
</select>
***********************FIM DO CODIGO SELECT OPTION-----
testar o codigo em Php no site http://phptester.net
banco e tabela
video https://www.youtube.com/watch?v=N3t4tDDLaFI
<?php
//ajaxdeleteselected.php
include"dbcon.php";
$selected = $_POST['selected'];
foreach ($selected as $value) {
$sql = "DELETE FROM tblemployees WHERE id='$value'";
if ($conn->query($sql) === TRUE) {
echo "Record deleted successfully $value <br/>";
} else {
echo "Error deleting record: " . $sql . "<br>" . $conn->error."'";
}
}
?> -- Banco de dados: `testing`
CREATE TABLE `tblemployees` (
`id` int(11) NOT NULL,
`fullname` varchar(50) DEFAULT NULL,
`emailadd` varchar(50) DEFAULT NULL,
`address` varchar(50) DEFAULT NULL,
`phone` varchar(50) DEFAULT NULL,
`created_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `tblemployees` (`id`, `fullname`, `emailadd`, `address`, `phone`, `created_at`) VALUES
(1, 'ALCEU JOSE', 'alceu@yakps.com.br', 'ONZE', '3931-4183', '2021-03-09 21:58:53'),
(2, 'BENE', NULL, 'SILVA', NULL, '2020-06-05 19:38:40'),
(3, 'CACILDA', NULL, 'BRAVA', NULL, '2020-06-05 20:07:05'),
(4, 'ALICE ', NULL, 'SILVA', NULL, '2020-06-05 20:07:39'),
(5, 'RANDOLFO', NULL, 'tadeu', NULL, '2021-01-29 07:58:59'),
(6, 'BEZERRA DA SILVA', 'alceu@uahoo.com.br', 'RUA NAO SEI, 45', '3931-4183', '2021-03-09 22:03:35');
ALTER TABLE `tblemployees`
ADD PRIMARY KEY (`id`);
ALTER TABLE `tblemployees`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
<?php
//dbcon.php
$conn = new mysqli('localhost','root','','testing');
if ($conn->connect_error) {
die('Error : ('. $conn->connect_errno .') '. $conn->connect_error);
}
?> index.php video https://www.youtube.com/watch?v=N3t4tDDLaFI <!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Language" content="pt-br"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Data Table </title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// Activate tooltip
$('[data-toggle="tooltip"]').tooltip();
// Select/Deselect checkboxes
var checkbox = $('table tbody input[type="checkbox"]');
$("#selectAll").click(function(){
if(this.checked){
checkbox.each(function(){
this.checked = true;
});
} else{
checkbox.each(function(){
this.checked = false;
});
}
});
checkbox.click(function(){
if(!this.checked){
$("#selectAll").prop("checked", false);
}
});
$('#cmdeleteselected').click (function(event) {
event.preventDefault();
var selected = new Array();
$("input:checkbox[name=options]:checked").each(function() {
selected.push($(this).val());
});
var selectedString = selected.join(",");
$.post("ajaxdeleteselected.php", {selected: selected },
function(data){
$('#deleteEmployeeModalselected').modal('hide');
$('.result').html(data);
});
});
});
</script>
</head>
<body>
<?php
include"dbcon.php";
if(isset($_POST["cmdaddnew"])){
$sql = "INSERT INTO tblemployees (fullname, emailadd, address, phone)
VALUES ('".$_POST["fullname"]."','".$_POST["emailadd"]."','".$_POST["address"]."','".$_POST["phone"]."')";
if ($conn->query($sql) === TRUE) {
echo "<script type= 'text/javascript'>alert('Adicionado com successfully');</script>";
} else {
echo "<script type= 'text/javascript'>alert('Error: " . $sql . "<br>" . $conn->error."');</script>";
}
}
$page = (isset($_GET['page']))?$_GET['page']:'';
$editemployee = (isset($_GET['editemployee']))?$_GET['editemployee']:'';
$deleteemployee = (isset($_GET['deleteemployee']))?$_GET['deleteemployee']:'';
if ($deleteemployee==''){
}else{
echo "<script type= 'text/javascript'>$(document).ready(function(){ $('#deleteEmployeeModal').modal() });</script>";
}
if(isset($_POST["cmdelete"])){
$sql = "DELETE FROM tblemployees WHERE id='$deleteemployee'";
if ($conn->query($sql) === TRUE) {
echo "<script type= 'text/javascript'>alert(' Deletado com success !! ');
window.location.replace('index.php');</script>";
} else {
echo "<script type= 'text/javascript'>alert('Error deleting record: " . $sql . "<br>" . $conn->error."');</script>";
}
}
if ($editemployee==''){
}else{
echo "<script type= 'text/javascript'>$(document).ready(function(){ $('#editEmployeeModal').modal() });</script>";
$results = mysqli_query($conn,"SELECT * FROM tblemployees Where id=$editemployee");
while($row = mysqli_fetch_array($results))
{
$editid = $row["id"];
$edit_fullname = $row["fullname"];
$edit_emailadd = $row["emailadd"];
$edit_address = $row["address"];
$edit_phone = $row["phone"];
}
}
if(isset($_POST["cmdedit"])){
$editname = $_POST["editname"];
$editemail = $_POST["editemail"];
$editaddress = $_POST["editaddress"];
$editphone = $_POST["editphone"];
$sql = "UPDATE tblemployees SET fullname='$editname', emailadd='$editemail', address='$editaddress', phone='$editphone' WHERE id='$editemployee'";
if (mysqli_query($conn, $sql)) {
echo "<script type= 'text/javascript'>alert('Alterado com successo!!! ');
window.location.replace('index.php');</script>";
} else {
echo "<script type= 'text/javascript'>alert('Error ao Gravar : " . $sql . "<br>" . $conn->error."');</script>";
}
}
if ($page==''){
$page = "1";
}else{
$page = $_GET['page'];
}
$cur_page = $page;
$page -= 1;
$per_page = 9; // ESTAVA 5
$previous_btn = true;
$next_btn = true;
$first_btn = true;
$last_btn = true;
$start = $page * $per_page;
//
//--------------- nome
$w_filtro = ''; // variavel auxilia no filto do select
$w_ordem = ''; // variavel auxilia no ordernar o select
if( !empty($_GET["pesq"]) ){
$pesq = $_GET["pesq"];
switch ( $_GET["ordem"] ) {
case 'name':
$w_filtro = $w_filtro . " and ( fullname LIKE '%".$pesq."%' or id = '".$pesq."' ) ";
break;
case 'ID':
$w_filtro = $w_filtro . " and ( fullname LIKE '%".$pesq."%' or id = '".$pesq."' ) ";
break;
}
}
if( !empty($w_filtro)) {
//
$w_len = strlen ( $w_filtro ) - 4;
//
$w_filtro = " where ".substr($w_filtro, -$w_len);
}
switch ( @$_GET["ordem"] ) {
case 'name':
$w_ordem = " order by fullname,id asc ";
break;
case 'ID':
$w_ordem = " ORDER BY ID asc ";
break;
}
if( empty($w_ordem) ){
$w_ordem = " ORDER BY fullname asc ";
}
$query_pag_data = "SELECT * from tblemployees ". $w_filtro.$w_ordem." LIMIT $start, $per_page";
$result_pag_data = mysqli_query($conn, $query_pag_data);
?>
<div class="container"><div class = "result"></div>
<p><h5 align="center">Cadastro <b>Funcionarios </h5></p>
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
</div>
<div class='container'>
<form name="pesquisa" action="index.php" method="get" id='form-contato' class="form-horizontal col-md-10">
<div class="panel panel-default">
<div class="panel-body">
<input type="text" size="40" name="pesq" placeholder="Digite o Nome ou ID">
<!-- <input type="submit" value="Busca" class="btn btn-xs btn-primary" /> -->
<button type="submit" name="buscar" id="buscar" title="buscar" class="btn btn-xs btn-info"> <span class="glyphicon glyphicon-search" ></span>Busca </button>
<label>Por:</label>
<select name = "ordem">
<option selected>name</option>
<option>ID</option>
</div>
</SELECT>
<!-- Link para página de cadastro -->
<a type="button" href="index.php" class="btn btn-warning" title="Sair"><span class="glyphicon glyphicon-home"></span></a>
<a title="List" href='lista1.php' class="btn btn-info "><span class="glyphicon glyphicon-print"></span></a>
<a Title="Novo" href="#addEmployeeModal" class="btn btn-success" data-toggle="modal"> <span>Add Pessoa</span></a>
</div>
</div>
</form>
</div>
</div>
</div>
<?
@$pesq = $_GET["pesq"];
?>
<table class="table table-striped table-bordered table-responsive table-hover" style="font-size: 14px;" >
<thead class="success">
<tr>
<th>
<span class="custom-checkbox">
<input type="checkbox" id="selectAll">
<label for="selectAll"></label>
</span>
</th>
<th>Name</th>
<th>Email</th>
<th>Endereco</th>
<th>Phone</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_assoc($result_pag_data)) {
$fullname=$row['fullname'];
$emailadd=$row['emailadd'];
$address=$row['address'];
$phone=$row['phone'];
?>
<tr>
<td>
<span class="custom-checkbox">
<input type="checkbox" id="checkbox1" name="options" value="<?php echo $row['id']; ?>">
<label for="checkbox1"></label>
</span>
</td>
<td><?php echo $fullname; ?></td>
<td><?php echo $emailadd; ?></td>
<td><?php echo $address; ?></td>
<td><?php echo $phone; ?></td>
<td>
<a href="?editemployee=<?php echo $row['id']; ?>" class="edit" class="btn btn-info" data-toggle="modal"><i class="glyphicon glyphicon-edit" title="Edit"></i></a>
<a title="Delete" href="?deleteemployee=<?php echo $row['id']; ?>" class="delete" data-toggle="modal"><i class="glyphicon glyphicon-trash" ></i></a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="clearfix">
<?php
$msg = "";
$query_pag_num = mysqli_query($conn,"SELECT COUNT(*) AS mycount FROM tblemployees" ) or die(mysqli_error($this->dblink));
$res = mysqli_fetch_object($query_pag_num);
$count = $res->mycount;
$no_of_paginations = ceil($count / $per_page);
// --------------------------------------------Calculando os valores inicial e final para o loop ----------------------------------
if ($cur_page >= 7) {
$start_loop = $cur_page - 3;
if ($no_of_paginations > $cur_page + 3)
$end_loop = $cur_page + 3;
else if ($cur_page <= $no_of_paginations && $cur_page > $no_of_paginations - 6) {
$start_loop = $no_of_paginations - 6;
$end_loop = $no_of_paginations;
} else {
$end_loop = $no_of_paginations;
}
} else {
$start_loop = 1;
if ($no_of_paginations > 7)
$end_loop = 7;
else
$end_loop = $no_of_paginations;
}
//-----------------------------------------------------------------------------------------------------------
$msg .= "<ul class=\"pagination\">";
// FOR ENABLING THE FIRST BUTTON
if ($first_btn && $cur_page > 1) {
$msg .= "<li p='1' class='page-item active'><a href='?page=1' class='page-link'>First</a></li>";
} else if ($first_btn) {
$msg .= "<li p='1' class='page-item' disabled><a href='?page=1'>First</a></li>";
}
// FOR ENABLING THE PREVIOUS BUTTON
if ($previous_btn && $cur_page > 1) {
$pre = $cur_page - 1;
$msg .= "<li p='$pre' class='page-item active'><a href='?page=$pre' class='page-link'>Previous</a></li>";
} else if ($previous_btn) {
$msg .= "<li class='page-item' disabled><a href='?page=1'>Previous</a></li>";
}
for ($i = $start_loop; $i <= $end_loop; $i++) {
if ($cur_page == $i)
$msg .= "<li p='$i' class='page-item active'><a href='?page=$i' class='page-link'>{$i}</a></li>";
else
$msg .= "<li p='$i' class='page-item'><a href='?page={$i}' class='page-link'>{$i}</a></li>";
}
// TO ENABLE THE NEXT BUTTON
if ($next_btn && $cur_page < $no_of_paginations) {
$nex = $cur_page + 1;
$msg .= "<li p='$nex' class='page-item'><a href='?page=$nex' class='page-link'>Next</a></li>";
} else if ($next_btn) {
$msg .= "<li class='page-item' disabled><a href='#'>Next</a></li>";
}
// TO ENABLE THE END BUTTON
if ($last_btn && $cur_page < $no_of_paginations) {
$msg .= "<li p='$no_of_paginations' class='page-item'><a href='?page=$no_of_paginations' class='page-link'>Last</a></li>";
} else if ($last_btn) {
$msg .= "<li p='$no_of_paginations' class='page-item' disabled><a href='?page=$no_of_paginations'>Last</a></li>";
}
$total_string = "<div class=\"hint-text\">Mostrando <b>" . $cur_page . "</b> out of <b>$no_of_paginations</b> entries</div>";
$msg = $msg . "</ul>";
echo $total_string;
echo $msg;
?>
</div>
</div>
</div>
<!-- add Modal HTML -->
<div id="addEmployeeModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<form action="" method="post">
<div class="modal-header">
<h4 class="modal-title">Add Funcionario</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="form-group">
<label>Name</label>
<input type="text" name="fullname" class="form-control" required>
</div>
<div class="form-group">
<label>Email</label>
<input type="email" name="emailadd" class="form-control" required>
</div>
<div class="form-group">
<label>Endereco</label>
<textarea class="form-control" name="address" required></textarea>
</div>
<div class="form-group">
<label>Fone</label>
<input type="text" name="phone" class="form-control" required>
</div>
</div>
<div class="modal-footer">
<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">
<input type="submit" class="btn btn-success" name="cmdaddnew" value="Add">
</div>
</form>
</div>
</div>
</div>
<!-- Edit Modal HTML -->
<div id="editEmployeeModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<form name="frmedit" action="" method="post">
<div class="modal-header">
<h4 class="modal-title">Edit Funcionario</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="form-group">
<label>Name</label>
<input type="text" name="editname" value="<?php echo $edit_fullname; ?>" class="form-control" required>
</div>
<div class="form-group">
<label>Email</label>
<input type="email" name="editemail" value="<?php echo $edit_emailadd; ?>" class="form-control" required>
</div>
<div class="form-group">
<label>Endereco </label>
<textarea class="form-control" name="editaddress" required><?php echo $edit_address; ?></textarea>
</div>
<div class="form-group">
<label>Fone</label>
<input type="text" name="editphone" value="<?php echo $edit_phone; ?>" class="form-control" required>
</div>
</div>
<div class="modal-footer">
<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">
<input type="submit" name="cmdedit" class="btn btn-info" value="Gravar">
</div>
</form>
</div>
</div>
</div>
<!-- Delete Modal HTML -->
<div id="deleteEmployeeModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<form name="frmdelete" action="" method="post">
<div class="modal-header">
<h4 class="modal-title">Delete Funcionario</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<p>Confirma a Exclusao ?</p>
<p class="text-warning"><small>Esta acao nao pode ser desfeita.</small></p>
</div>
<div class="modal-footer">
<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">
<input type="submit" name="cmdelete" class="btn btn-danger" value="Delete">
</div>
</form>
</div>
</div>
</div>
<div id="deleteEmployeeModalselected" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<form name="frmdelete" action="" method="post">
<div class="modal-header">
<h4 class="modal-title">Delete Selected Employee</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<p>Are you sure you want to all the selected delete Records?</p>
<p class="text-warning"><small>This action cannot be undone.</small></p>
</div>
<div class="modal-footer">
<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">
<a href="#" id="cmdeleteselected" class="btn btn-danger">Delete</a>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
<!---
<table class="table table-striped table-hover">
-->
<!-- Modal extra grande -->
<button class="btn btn-primary" data-toggle="modal" data-target=".bd-example-modal-xl">Modal extra grande</button>
<div class="modal fade bd-example-modal-xl" tabindex="-1" role="dialog" aria-labelledby="myExtraLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
...
</div>
</div>
</div>
<!-- Modal grande -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bd-example-modal-lg">Modal grande</button>
<div class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
...
</div>
</div>
</div>
<!-- Modal pequeno -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bd-example-modal-sm">Modal pequeno</button>
<div class="modal fade bd-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
...
</div>
</div>
</div>
agenda86
<!DOCTYPE html>
<?php
$bd = 'mlcexpre_agua';
$conecta = ($GLOBALS["___mysqli_ston"] = mysqli_connect("localhost", "root" , "")) or die("NAO ACHE O USUARIO DO BCO");
$bd = mysqli_select_db($conecta, $bd) or die("Nao achei o bco de Dados");
?>
<html lang="pt=BR">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Cadastro Cliente</title>
</head>
<body style="font-size: 14px;" >
<?php
class Agenda {
private $id;
private $nome;
private $email;
private $ddd;
private $telefone;
private $endereco;
private $cidade;
private $estado;
public function cadastro($nome, $email, $ddd, $telefone,$endereco,$cidade, $estado ) {
$this->nome = $nome;
$this->email = $email;
$this->ddd = $ddd;
$this->telefone = $telefone;
$this->endereco = $endereco;
$this->cidade = $cidade;
$this->estado = $estado;
$sql_cadastro = mysqli_query($GLOBALS["___mysqli_ston"], "INSERT INTO Agenda SET nome = '$this->nome', email = '$this->email', ddd= '$this->ddd', telefone = '$this->telefone' ,endereco='$this->endereco', cidade='$this->cidade',estado='$this->estado' ");
echo '<meta http-equiv="refresh" content="0; url=agenda86.php"';
}
public function edita($id, $nome, $email,$ddd, $telefone,$endereco,$cidade, $estado ) {
$this->id = $id;
$this->nome = $nome;
$this->email = $email;
$this->ddd = $ddd;
$this->telefone = $telefone;
$this->endereco = $endereco;
$this->cidade = $cidade;
$this->estado = $estado;
$sql_editar = mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE Agenda SET nome = '$this->nome', email = '$this->email', ddd= '$this->ddd', telefone = '$this->telefone', endereco='$this->endereco', cidade='$this->cidade',estado='$this->estado' WHERE id = $this->id");
echo '<meta http-equiv="refresh" content="0; url=agenda86.php"';
}
public function deleta ($id) {
$this->id = $id;
$qry_del = mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM Agenda WHERE id = $this->id");
echo"
<script type='text/javascript'>
alert(' Registro excluido com sucesso ');
window.location='agenda86.php';
</script>
";
}
}
$agenda = new Agenda;
if(@$_GET['pg'] == 'altera') {
if(!empty($_GET['cod'])) {
$id = $_GET['cod'];
$sql_edita = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM Agenda WHERE id = $id");
$res = mysqli_fetch_array($sql_edita);
?>
<h3 align="left">Alterar Clientes </h3>
<?php if(@$_POST['enviar'] == 'Gravar'){
$nome = $_POST['nome'];
$email = $_POST['email'];
$ddd = $_POST['ddd'];
$telefone = $_POST['telefone'];
$endereco = $_POST ["endereco"];
$cidade = $_POST ["cidade"];
$estado = $_POST ["estado"];
$agenda->edita($id, $nome, $email, $ddd, $telefone, $endereco, $cidade, $estado);
}
echo '
<div style="float: left;">
<form action="" enctype="multipart/form-data" name="Gravar" method="post" >
<fieldset style="background-color: #E9ECF5 ; color:#FFFFF; font-size: 18px;" >
<legend>ALTERAR</legend>
<label> Nome: </label> <input type="text" name="nome" size="70" maxlength="60" value="' .$res['nome']. ' "/> <br>
<label> Email: </label> <input type="text" name="email" size="70" maxlength="60" value="' .$res['email']. ' "/><br>
<label> Ddd: </label> <input type="text" name="ddd" size="4" maxlength="2" value="' .$res['ddd']. ' "/><br>
<label> Telefone: </label> <input type="text" name="telefone" value="' .$res['telefone']. ' "/> <br>
<label> Endereco: </label> <input type="text" name="endereco" size="70" maxlength="70" value="' .$res['endereco']. ' " /> <br>
<label> Cidade: </label> <input type="text" name="cidade" size="20" maxlength="20" value="' .$res['cidade']. ' " /> <br>
<tr>
<td>Estado:</td>
<td><select name="estado" >
<option value="SP">SP</option>
<option value="TO">TO</option>
</select>
<span class="style1">* </span></td>
</tr>
<input type="submit" name="enviar" value="Gravar" />
<a type="button" value="Sair" href="agenda86.php">Cancela</a>
<a style="background-color:#c00; color:#ff7; font-size: 18px; onclick="return confirm();" href="agenda86.php?pg=deleta&cod='.$res["id"].'"> Deleta </a>
</form>
</fieldset>
</div>
<p style="margin-bottom: 12800px;"></p>
';
}
}
?>
<?php
if(@$_GET['pg'] == 'novo') {
echo ' <h2>Incluir NOVO CLIENTE </h2> ';
if(@$_POST['enviar'] == 'Cadastrar'){
$nome = $_POST['nome'];
$email = $_POST['email'];
$ddd = $_POST['ddd'];
$telefone = $_POST['telefone'];
$endereco = $_POST ["endereco"];
$cidade = $_POST ["cidade"];
$estado = $_POST ["estado"];
$agenda->cadastro($nome, $email, $ddd, $telefone,$endereco,$cidade,$estado );
}
echo '
<div style="float: left;">
<form action="" enctype="multipart/form-data" name="Gravar" method="post" >
<fieldset style="background-color: #E9ECF5 ; color:#FFFFF; font-size: 18px;" >
<label> Nome: </label> <input type="text" name="nome" size="70" maxlength="60" /> <br>
<label> Email: </label> <input type="text" name="email" size="70" maxlength="60"/> <br>
<label> Ddd: </label> <input type="text" name="ddd" /> <br>
<label> Telefone: </label> <input type="text" name="telefone" /> <br>
<label> Endereco: </label> <input type="text" name="endereco" size="70" maxlength="60" /> <br>
<label> Cidade: </label> <input type="text" name="cidade" /> <br>
<tr>
<td>Estado :</td>
<td><select name="estado" >
<option value="SP">SP</option>
<option value="TO">TO</option>
</select>
<span class="style1">* </span></td>
</tr>
<input type="submit" name="enviar" value="Cadastrar" />
<a style="background-color:#CEF6D8; color:#fffff; " type="button" href="agenda86.php">Cancela</a>
</fieldset>
</form>
</div>
<p style="margin-bottom: 112800px;"></p>
';
}
if(@$_GET['pg'] == 'deleta') {
if(!empty($_GET['cod'])) {
$id = $_GET['cod'];
$agenda->deleta($id);
}
}
?>
<div class='container'>
<input type="button" value="Sair" class="btn btn-primary" onclick="window.location.href='index2.php';" />
<div class='clearfix'></div>
<table align="center" border="1" cellpadding="4" cellspacing="0" width="80%">
<tbody>
<th style="background-color:#53CEDF; color:#fff; font-size: 12px;" colspan="10" href="agenda86.php?pg=novo" >Cadastro de Clientes </th>
<th style="background-color:#53CEDF; color:#fffff;" colspan="10"> <a href="agenda86.php?pg=novo" title="Adiciona" ><strong> Cliente</strong></a> </th>
<tr align="center">
<td bgcolor="#CEF6D8"><input type="button" title="Adiciona" onclick="window.location.href='agenda86.php?pg=novo';" value="Inclui" > </td>
<td bgcolor="#CEF6D8" width="8%"><input type="button" onclick="window.location.href='index2.php';" value="Sair"/> </td>
<td bgcolor="#CEF6F5" align="left" width="25%">Nome</td>
<td bgcolor="#CEF6F5" align="left" width="25%">Endereco</td>
<td bgcolor="#CEF6F5" align="left" width="25%">Cidade</td>
<td bgcolor="#CEF6F5" align="left" width="8%">UF</td>
<td bgcolor="#CEF6F5" align="left" width="25%">Email</td>
<td bgcolor="#CEF6F5" align="left" width="8%">Ddd</td>
<td bgcolor="#CEF6F5" align="left" width="25%">Telefone</td>
<td bgcolor="#CEF6D8"><input type="button" value="Imprime" onclick="javascript:window.print();" title="Imprimir" > </td>
</tr>
</tbody>
<?php
$qry =mysqli_query($conecta, "SELECT * FROM Agenda order by nome") or die(mysqli_error($GLOBALS["___mysqli_ston"]));
while($resultado=mysqli_fetch_array($qry)) { ?>
<tr>
<td><a type="button" href="agenda86.php?pg=altera&cod=<?php echo $resultado["id"]; ?>">Edit</a></td>
<td><?php echo $resultado["id"]; ?></td>
<td><?php echo $resultado["nome"]; ?></td>
<td><?php echo $resultado["endereco"]; ?></td>
<td><?php echo $resultado["cidade"]; ?></td>
<td><?php echo $resultado["estado"]; ?></td>
<td><?php echo $resultado["email"]; ?></td>
<td><?php echo $resultado["ddd"]; ?></td>
<td><?php echo $resultado["telefone"]; ?></td>
<td align="center" ><a onclick="return confirm('Excluir ?');" href="agenda86.php?pg=deleta&cod=<?php echo $resultado["id"];?>">Del</a></td>
</tr>
<?php
}
echo '</table>';
?>
</body>
</html>
<!-- Link para página de cadastro
CREATE TABLE `Agenda` (
`id` int(11) NOT NULL,
`nome` varchar(70) CHARACTER SET utf8 NOT NULL,
`endereco` varchar(50) CHARACTER SET utf8 NOT NULL,
`cidade` varchar(30) CHARACTER SET utf8 NOT NULL,
`estado` varchar(2) NOT NULL,
`ddd` varchar(2) DEFAULT NULL,
`telefone` varchar(15) DEFAULT NULL,
`email` varchar(60) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
ALTER TABLE `agenda`
ADD PRIMARY KEY (`id`);
ALTER TABLE `agenda`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
-->
RElatorio
<?php
//relatorio
$bd_host = 'localhost';
$bd_user = 'root';
$bd_senha = '';
$bd = 'agenda';
$conecta = ($GLOBALS["___mysqli_ston"] = mysqli_connect($bd_host, $bd_user, $bd_senha)) or die(mysqli_error($GLOBALS["___mysqli_ston"]));
$bd = mysqli_select_db($conecta, $bd) or die(mysqli_error($GLOBALS["___mysqli_ston"]));
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>Relatorio </title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/custom.css">
</head>
<body>
<div>
<a title="Sair volta a pg anterior" href="javascript:history.go(-1);"> <div align="center" class="col-md-10 titulo">Relacao </div></a>
<p align="center"> <input name="Print" class="botao"
onclick="javascript:window.print();" title="imprmir" value="Gera" type="button"><font
face="Arial" size="2"> <input value="<<"
onclick="history.go(-1)" title="voltar" type="button"> </font></p>
</div>
<table class="table table-striped table-bordered table-hover table-condensed" style="font-size: 12px;" >
<thead>
<th class="b" align="center" width="1%"> ID</th>
<th class="b" align="center" width="5%"> NOME</th>
<thead>
</div>
<?php
$qry =mysqli_query($conecta, "SELECT * FROM contactos order by nombre") or die(mysqli_error($GLOBALS["___mysqli_ston"]));
while ($resultado = mysqli_fetch_array( $qry)) {
?>
<tr >
<td><?php echo $resultado["id"]; ?></td>
<td><?php echo $resultado["nombre"]; ?></td>
<?php
}
echo '</table>';
?>
</p>
</body>
</html>
CREATE TABLE `estados` (
`id` int(11) NOT NULL,
`sigla` varchar(2) CHARACTER SET utf8 NOT NULL,
`descricao` varchar(30) CHARACTER SET utf8 NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `estados` (`id`, `sigla`, `descricao`) VALUES
(1, 'SP', 'Sao Paulo '),
(2, 'AL', 'Alagoas '),
(3, 'AP', 'Amapa '),
(4, 'AM', 'Amazonas'),
(5, 'BA', 'Bahia'),
(6, 'CE', 'Ceara'),
(7, 'DF', 'Distrito Federal '),
(8, 'ES', 'Espirito Santo '),
(9, 'GO', 'Goias '),
(10, 'MA', 'Maranhao'),
(11, 'MT', 'Mato Grosso'),
(12, 'MS', 'Mato Grosso do Sul'),
(13, 'MG', 'Minas Gerais'),
(14, 'PA', 'Para'),
(15, 'PB', 'Paraiba '),
(16, 'PR', 'Parana'),
(17, 'PE', 'Pernambuco'),
(18, 'PI', 'Piaui'),
(19, 'RJ', 'Rio de Janeiro'),
(20, 'RN', 'Rio Grande do Norte'),
(21, 'RS', 'Rio Grande do Sul'),
(22, 'RO', 'Rondonia '),
(23, 'RR', 'Roraima'),
(24, 'SC', 'Santa Catarina'),
(25, 'AC', 'ACRE '),
(26, 'SE', 'Sergipe'),
(27, 'TO', 'Tocantins'),
(34, 'AF', 'AFRICA ');
ALTER TABLE `estados`
ADD PRIMARY KEY (`id`);
ALTER TABLE `estados`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36;
<!DOCTYPE html>
<html lang="pt=BR">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="pt-br">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Estados</title>
<link rel="stylesheet" href="bootstrap_336/css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
<!-- Loader -->
<link rel="stylesheet" href="css/loader.css">
<script src="js/jquery-1.12.4.js"></script>
<link rel="stylesheet" type="text/css" href="dashboard/vendor/font-awesome/css/font-awesome.min.css">
<script>
$(document).ready(function() {
$('#example').DataTable({});
});
</script>
<link rel="stylesheet" href="css/jquery.dataTables.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="css/responsive.bootstrap.min.css">
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
</head>
<body>
<?Php
@$registros = 7;
include("dbcon.php");
if(isset($_POST["cmdaddnew"])){
$w1 = $_POST["sigla"];
$w2 = $_POST["descricao"];
$sql="INSERT INTO estados set sigla='$w1',descricao='$w2'" or die(mysqli_error($this->dblink));
if ($conn->query($sql) === TRUE) {
echo "<script type='text/javascript'>alert('Incluso c/Exito ');</script>";
} else {
echo "<script type='text/javascript'>alert('Error:ao Incluir " . $sql . "<br>" . $conn->error."');</script>";
}
}
$editemployee = (isset($_GET['editemployee']))?$_GET['editemployee']:'';
if (isset($_GET['acao']) && $_GET['acao'] == 'cmdelete') {
$id = $_GET['id'];
$sql = "DELETE FROM estados WHERE id='$id'";
if ($conn->query($sql) === TRUE) {
echo "<script type= 'text/javascript'>alert('Registro Deletado com success !! ');
window.location.replace('estados1.php');</script>";
} else {
echo "<script type= 'text/javascript'>alert('Error deleting record: " . $sql . "<br>" . $conn->error."');</script>";
}
exit();
}
if ($editemployee==''){
}else{
echo "<script type= 'text/javascript'>$(document).ready(function(){ $('#editEmployeeModal').modal() });</script>";
$results = mysqli_query($conn,"SELECT * FROM estados Where id='$editemployee'");
while($row = mysqli_fetch_array($results))
{
$id = $row["id"];
$edsigla = $row["sigla"];
$eddescricao = $row["descricao"];
}
}
if(isset($_POST["cmdedit"])){
$edsigla = $_POST["sigla"];
$eddescricao = $_POST["descricao"];
$sql = "UPDATE estados SET sigla='$edsigla',descricao='$eddescricao' WHERE id='$editemployee' " ;
if (mysqli_query($conn, $sql)) {
echo "<script type= 'text/javascript'>alert('EDITOU c/Exito !');
window.location.replace('estados1.php');</script>";
} else {
echo "<script type='text/javascript'>alert('Error:a Gravar " . $sql . "<br>" . $conn->error."');</script>";
}
}
?>
<div class="container"><div class = "result"></div>
<p><h5 align="center">Cadastro de Estados </h5></p>
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
</div>
<div class='container'>
<form name="pesquisa" action="estados1.php" method="get" id='form-contato' class= "form-horizontal col-md-10">
<div class="panel panel-default">
<div class="panel-body">
<input type="text" size="40" name="pesq" placeholder="Bote o Nome ou ID">
<button type="submit" name="buscar" id="buscar" class="btn btn-info"> <span class="glyphicon glyphicon-search" ></span> </button>
<label>Por:</label>
<select name = "ordem">
<option selected>name</option>
<option>ID</option>
</div>
</SELECT>
<a type="button" Title="Sai" href="ajuda.php" class="btn btn-danger" ><span class="glyphicon glyphicon-home"></span></a>
<a Title="Novo" href="#addEmployeeModal" class="btn btn-info" data-toggle="modal"> <span>Novo</span></a>
<a type="button" href='resta1.php' class="btn btn-primary "><span class="glyphicon glyphicon-print" ></span>-</a>
</div>
</div>
</form>
</div>
</div>
</div>
<?
@$pesq = $_GET["pesq"];
?>
<div class="container">
<div class="row">
<table class="table table-striped table-bordered table-responsive table-hover" style="font-size: 14px;" >
<thead class="success">
<tr class="info">
<th width="7%" >Actions</th>
<th width="9%"> SIGLA</th>
<th width="9%"> DESCRICAO</th>
<th width="2%"> ID</th>
</tr>
</thead>
<tbody>
</div>
<?Php
$pagina = (isset($_GET["pagina"]))? $_GET["pagina"] : 1;
$cmd = "select * from estados order by sigla asc";
$produtos = mysqli_query($conn, $cmd);
$total = mysqli_num_rows($produtos);
$numPaginas = ceil($total/$registros);
$inicio = ($registros*$pagina)-$registros;
$w_filtro = '';
$w_ordem = '';
if( !empty($_GET["pesq"]) ){
$pesq = $_GET["pesq"];
switch ( $_GET["ordem"] ) {
case 'name':
$w_filtro = $w_filtro . " and ( sigla LIKE '%".$pesq."%' or id='".$pesq."') ";
break;
case 'ID':
$w_filtro = $w_filtro . " and ( sigla LIKE '%".$pesq."%' or id='".$pesq."') ";
break;
}
}
if( !empty($w_filtro)) {
$w_len = strlen ( $w_filtro ) - 4;
$w_filtro = " where ".substr($w_filtro, -$w_len);
}
switch ( @$_GET["ordem"] ) {
case 'name':
$w_ordem = " order by sigla,id asc ";
break;
case 'ID':
$w_ordem = " ORDER BY ID asc ";
break;
}
if( empty($w_ordem) ){
$w_ordem = " ORDER BY sigla asc ";
}
$query_pag_data = "SELECT * From estados ". $w_filtro.$w_ordem." limit $inicio,$registros ";
$result_pag_data = mysqli_query($conn, $query_pag_data);
if (!$result_pag_data) {
die("Falha na Busca (".mysqli_error($GLOBALS["___mysqli_ston"]).")");
}
while($row = mysqli_fetch_assoc($result_pag_data)) {
?>
<tr>
<td>
<a href="?editemployee=<?php echo $row['id']; ?>" class="edit" class="btn btn-info" data-toggle="modal"><i class="glyphicon glyphicon-edit" ></i></a>
<a href="estados1.php?&acao=cmdelete&id=<?php echo $row['id']; ?>" onclick="return confirm('Exclui ?');" ><i class="glyphicon glyphicon-trash" ></i></a>
</td>
<td><?php echo $row["sigla"]; ?></td>
<td><?php echo $row["descricao"]; ?></td>
<td><?php echo $row["id"]; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<nav style="text-align:center; font-size:16px;">
<ul class="pagination" >
<li class="page-item" style="background-color:#c00; color:#ff7;" >
<a class="page-link" class="info" href="estados1.php?pagina=1" >Inicio</a>
</li>
<?php
for($i = 1; $i < $numPaginas + 1; $i++) {
@$estilo = "";
if($pagina == $i)
$estilo = "class=\"active\"";
?>
<li <?php echo $estilo; ?> class="page-item"><a class="page-link" style="font-size: 14px;" href="estados1.php?pagina= <?php echo ($i ); ?>"><?php echo ($i); ?> </a> </li>
<?php
}
?>
<li class="page-item"><a class="page-link" href="estados1.php?pagina=<?php echo ($numPaginas ); ?> "> Fim </a></li>
</ul>
</nav>
<br>
<div class="clearfix">
<!-- add Modal HTML -->
<div class="container-fluid">
<div id="addEmployeeModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<form action="" method="post">
<fieldset style="background-color: #E9ECF5 ; color:#FFFFF; font-size: 12px;" >
<div class="modal-header bg-info">
<h5 class="modal-title">Adiciona </h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="form-group">
<label>SIGLA </label>
<input type="text" name="sigla" size="2" class="pfinput" />
</div>
<div class="form-group">
<label>DESCRICAO </label>
<input type="text" name="descricao" size="30" class="pfinput" />
</div>
</div>
<div class="modal-footer">
<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">
<input type="submit" class="btn btn-success" name="cmdaddnew" value="Add">
</div>
</fieldset>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div id="editEmployeeModal" class="modal fade-lg">
<div class="modal-dialog">
<div class="modal-content">
<form name="frmedit" action="" method="post">
<div class="modal-header bg-success">
<h5 class="modal-title">Edit </h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="form-group">
<label>SIGLA</label>
<input type="text" name="sigla" size="2" value="<?php echo $edsigla ; ?> " class="pfinput" />
</div>
<div class="form-group">
<label>DESCRICAO</label>
<input type="text" name="descricao" size="30" value="<?php echo $eddescricao ; ?> " class="pfinput" />
</div>
</div>
<div class="modal-footer">
<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">
<input type="submit" name="cmdedit" class="btn btn-info" value="Gravar">
</div>
</form>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
//dbcon.php
$conn = new mysqli('localhost','root','','testing');
if ($conn->connect_error) {
die('Error : ('. $conn->connect_errno .') '. $conn->connect_error);
}
?>
<?php
include("dbcon.php");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>Relatorio </title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/custom.css">
</head>
<body>
<div>
<a title="Sair " href="javascript:history.go(-1);"> <div align="center" class="col-md-10 titulo">Relacao </div></a>
<p align="center"> <input name="Print" class="botao"
onclick="javascript:window.print();" title="imprmir" value="Print" type="button"><font
face="Arial" size="2"> <input value="<<"
onclick="history.go(-1)" title="voltar" type="button"> </font></p>
</div>
<div class='container'>
<table class="table table-striped table-bordered table-hover table-condensed" style="font-size: 14px;" >
<thead>
<tr class="info">
<th class="b" bgcolor="#E0F8F7" align="left" width="1%">Id</th>
<th class="b" align="center" width="9%"> SIGLA</th>
<th class="b" align="center" width="9%"> DESCRICAO</th>
</tr>
<thead>
</div>
<?php
$qry =mysqli_query($conn,"SELECT * FROM estados order by sigla") or die(mysqli_error($GLOBALS["___mysqli_ston"]));
while ($resultado = mysqli_fetch_array( $qry)) {
?>
<tr >
<td> <?php echo $resultado["id"]; ?></td>
<td><?php echo $resultado["sigla"]; ?></td>
<td><?php echo $resultado["descricao"]; ?></td>
<?php
}
echo '</table>';
?>
</p>
</body>
</html>
backup
<html>
<head>
<meta http-equiv="Content-Language" content="pt-br">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Backup do sistema</title>
</head>
<body>
<a style="background-color:#c00; color:#fff; font-size: 18px;" href="index2.php"> = Voltar ao Menu = </a>
<?php
$checkUtf = true;
$bd_host = 'localhost';
$bd_user = 'root';
$bd_senha = '';
$bd = 'agua';
$dbname = 'agua';
$checkUtf = true;
$conecta = ($GLOBALS["___mysqli_ston"] = mysqli_connect($bd_host, $bd_user, $bd_senha)) or die(mysqli_error($GLOBALS["___mysqli_ston"]));
$bd = mysqli_select_db($conecta, $bd) or die(mysqli_error($GLOBALS["___mysqli_ston"]));
// gerando um arquivo sql. Como?
// a função fopen, abre um arquivo, que no meu caso, será chamado como: nomedobanco.sql
// note que eu estou concatenando dinamicamente o nome do banco com a extensão .sql.
$back = fopen($dbname . ".sql", "w");
// aqui, listo todas as tabelas daquele banco selecionado acima
$res = mysqli_query($conecta ,"SHOW TABLES FROM $dbname") or die(mysqli_error($GLOBALS["___mysqli_ston"]));
//=mysqli_query( $conecta ,
// ultra importante para não dar erro nos primeiros inserts
// principalmente de usar InnoDB e relacionar as tabelas
fwrite($back, "set foreign_key_checks=0;\n\n");
// regex para ver se o char é UTF-8
// Link: http://stackoverflow.com/questions/1401317/remove-non-utf8-characters-from-string
$regex1 = <<<'END'
/
( [\x00-\x7F] # single-byte sequences 0xxxxxxx
| [\xC0-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx
| [\xE0-\xEF][\x80-\xBF]{2} # triple-byte sequences 1110xxxx 10xxxxxx * 2
| [\xF0-\xF7][\x80-\xBF]{3} # quadruple-byte sequence 11110xxx 10xxxxxx * 3
)
| . # anything else
/x
END;
// resgato cada uma das tabelas, num loop
while ($row = mysqli_fetch_row($res))
{
$table = $row[0];
// usando a função SHOW CREATE TABLE do mysql, exibo as funções de criação da tabela,
// exportando também isso, para nosso arquivo de backup
$res2 = mysqli_query($conecta ,"SHOW CREATE TABLE $table");
// digo que o comando acima deve ser feito em cada uma das tabelas
while ($lin = mysqli_fetch_row($res2)) {
// instruções que serão gravadas no arquivo de backup
fwrite($back, "\n#\n# //Criação da Tabela : $table\n#\n\n");
fwrite($back, "$lin[1] ;\n\n#\n# //Dados a serem incluídos na tabela\n#\n\n");
// seleciono todos os dados de cada tabela pega no while acima
// e depois gravo no arquivo .sql, usando comandos de insert
$res3 = mysqli_query($conecta ,"SELECT * FROM $table");
$first = true;
while ($r = mysqli_fetch_row($res3))
{
if ($first)
{
$sql = "INSERT INTO $table VALUES ";
$first = false;
}
else
{
$sql .= ',';
}
$sql .= "('";
$imploded = '';
$firstImplode = true;
foreach ($r as $reg)
{
if ($firstImplode)
{
$firstImplode = false;
}
else
{
$imploded .= "', '";
}
if ($checkUtf)
{
$escaped = str_replace('\'', "\\'", str_replace('\\', "\\\\", preg_replace($regex1, '$1', $reg)));
}
else
{
$escaped = str_replace('\'', "\\'", str_replace('\\', "\\\\", $reg));
}
$imploded .= $escaped;
}
$sql .= $imploded;
$sql .= "')\n";
}
if (!$first)
{
$sql .= ";\n";
fwrite($back, $sql);
}
}
}
echo '<a style="background-color:#c00; color:#fff; font-size: 18px;" href="index2.php"> = Voltar ao Menu = </a>';
// fechar o arquivo que foi gravado
fclose($back);
// gerando o arquivo para download, com o nome do banco e extensão sql.
$arquivo = $dbname . ".sql";
Header("Content-type: application/sql");
Header("Content-Disposition: attachment; filename=$arquivo");
// lê e exibe o conteúdo do arquivo gerado
readfile($arquivo);
if($arquivo)
{
echo '<meta http-equiv="refresh" content="0; url=index2.php">';
echo "<script type='text/javascript'>alert('arquivo com sucesso!!!');</script>";
}
else {
echo "<script type='text/javascript'>alert('nao achei o arquivoso!!!');</script>";
echo '<meta http-equiv="refresh" content="0; url=index2.php">';
}
?>
</body>
</html>
<---->
BACKUP
Listando colunas de uma tabela
01. Listar apenas o nome das colunas
Nesse comando será listado os nomes das colunas em uma determinada tabela
1
2
3
4
5
6
$query=mysql_query("SHOW COLUMNS FROM tb") or die (mysql_error());
while ($coluna = mysql_fetch_assoc($query)) {
$coluna = $coluna["Field"];
echo "$coluna ";
}
Resultado:
02. Listar as colunas e seus atributos
É listado todos as colunas e seus atributos: Field,Type,Null,Key,Default,Extra…
1
2
3
4
5
$query = mysql_query("SHOW COLUMNS FROM nome_tabela");
while ($coluna = mysql_fetch_assoc($coluna)) {
print_r($coluna);
}
Resultado:
1
2
3
Array ( [Field] => matricula [Type] => text [Null] => NO [Key] => [Default] => [Extra] => )
Array ( [Field] => funcionario [Type] => text [Null] => NO [Key] => [Default] => [Extra] => )
Agora é com você
botao com tecla de atalho alt+p
<input type = "button" onClick = " abrePop () " value = "Pesquisar" accesskey = "p" >
<body style="background-color: rgb(214, 214,255); color: color:#FFFFF; font-size: 16px;"
Qdo Input não é Editavel readonly="readonly"
***
Era assim e ficou deste jeito
CREATE TABLE IF NOT EXISTS `test` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;
<?php
//MySql
//$con=mysql_connect("localhost","root","");
//mysql_select_db("youtube",$con);
//$sql="insert into test(name) values('Vishal')";
//$sql="select * from test";
//$res=mysql_query($sql);
//while($row=mysql_fetch_assoc($res)){
//echo '<pre>';
//print_r($row);
//}
//MySqli
//$con=mysqli_connect("localhost","root","","youtube");
//$sql="insert into test(name) values('Vishal')";
//$sql="select * from test";
//$res=mysqli_query($con,$sql);
//while($row=mysqli_fetch_assoc($res)){
//echo '<pre>';
//print_r($row);
//}
//PDO
$con=new PDO("mysql:host=localhost;dbname=youtube","root","");
//$sql="insert into test(name) values('Vishal55')";
$sql="select * from test";
$stmt=$con->prepare($sql);
$stmt->execute();
$row=$stmt->fetchAll(PDO::FETCH_ASSOC);
echo '<pre>';
print_r($row);
***
<?php
//Conexão e consulta ao Mysql
//mysql_connect('localhost','root','') or die(mysql_error());
//mysql_select_db('mysql') or die(mysql_error());
include("config.php");
$qry = mysql_query("select * from agenda order by nome");
//Pegando os nomes dos campos
$num_fields = mysql_num_fields($qry);//Obtém o número de campos do resultado
for($i = 0;$i<$num_fields; $i++){//Pega o nome dos campos
$fields[] = mysql_field_name($qry,$i);
}
//Montando o cabeçalho da tabela
$table = '<table border="1" style="font-size: 12px;" ><tr>';
for($i = 0;$i < $num_fields; $i++){
$table .= '<th>'.$fields[$i].'</th>';
}
//Montando o corpo da tabela
$table .= '<tbody>';
while($r = mysql_fetch_array($qry)){
$table .= '<tr>';
for($i = 0;$i < $num_fields; $i++){
$table .= '<td>'.$r[$fields[$i]].'</td>';
}
$table .= '</tr>';
}
//Finalizando a tabela
$table .= '</tbody></table>';
//Imprimindo a tabela
echo $table;
?>
****
PDO CONEXAO
<?php
//MySql
//$con=mysql_connect("localhost","root","");
//mysql_select_db("youtube",$con);
//$sql="insert into test(name) values('Vishal')";
//$sql="select * from test";
//$res=mysql_query($sql);
//while($row=mysql_fetch_assoc($res)){
//echo '<pre>';
//print_r($row);
//}
//MySqli
//$con=mysqli_connect("localhost","root","","youtube");
//$sql="insert into test(name) values('Vishal')";
//$sql="select * from test";
//$res=mysqli_query($con,$sql);
//while($row=mysqli_fetch_assoc($res)){
//echo '<pre>';
//print_r($row);
//}
//PDO
$con=new PDO("mysql:host=localhost;dbname=youtube","root","");
//$sql="insert into test(name) values('Vishal55')";
$sql="select * from test";
$stmt=$con->prepare($sql);
$stmt->execute();
$row=$stmt->fetchAll(PDO::FETCH_ASSOC);
echo '<pre>';
print_r($row);
?>
TABELA
CREATE TABLE IF NOT EXISTS `test` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
INSERT INTO `test` (`id`, `name`) VALUES
(1, 'Vishal'),
(2, 'Amit'),
(3, 'Sumit'),
(5, 'Vishal'),
(6, 'Vishal55');
Codigo de busca de cep
//inicio do codigo
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Clientes </title>
<script type="text/javascript">
function formatar_mascara(src, mascara) {
var campo = src.value.length;
var saida = mascara.substring(0,1);
var texto = mascara.substring(campo);
if(texto.substring(0,1) != saida) {
src.value += texto.substring(0,1);
}
}
</script>
</head>
<hr />
<?php
@$cep = $_POST['cep'];
function buscaCep($cep) {
global $retorno;
$cep = preg_replace("/[^0-9]/", "", $cep);
$resultado=file_get_contents("http://republicavirtual.com.br/web_cep.php?cep=$cep&formato=query_string");
$logradouro= urldecode($resultado);
$logradouro= parse_str($resultado,$retorno);
return $retorno;
}
buscacep($cep);
?>
<form method="post" action="">
<fieldset style="background-color: #E9ECF5 ; color:#FFFFF; font-size: 16px; width: 680px;" >
Cep <input type="text" name="cep" id="cep" onblur="buscacep();" SIZE = "8" maxlength="8" autofocus />
<input type="submit" name="buscacep();" value="Buscar" /> <br>
<label> Nome : <label> <input type="text" name="nome" size="40" /> <br>
<label> Endereco: </label> <input type="text" name="endereco" value="<?php
echo utf8_encode( $retorno['tipo_logradouro']) ." ". $retorno['logradouro']; ?>" SIZE = "50" maxlength="50" /><br>
<label> Bairro : <label> <input type="text" name="bairro" value="<?php echo utf8_encode($retorno['bairro']); ?>" />
<label> Cidade : <label> <input type="text" size="24" name="cidade" value="<?php echo utf8_encode($retorno['cidade']); ?>" />
UF : <input type="text" name="estado" size="2" value="<?php echo $retorno['uf']; ?>" /><br>
Cnpj:<input name="cnpj" id="cnpj" maxlength="18" size="18" type="text" onkeypress="formatar_mascara(this,'##.###.###/####-##')">
Fone:<input name="telefone" maxlength="14" size="10" type="text" onkeypress="formatar_mascara(this,'####-####')" ><br>
Celular:<input name="celular" maxlength="14" size="10" type="text" onkeypress="formatar_mascara(this,'##-#####-####')" ><br>
<label> Contato : <label> <input type="text" name="contato" size="20" /> <br>
<label> email : <label> <input type="text" name="email" size="40" /> <br>
<label> Cep : <label>
<?php
echo $cep ;
?>
</br>
</fieldset>
</form>
</html>
<!--
fim do codigo busca do cep
-->
Codigo Menu em Php com banco de dados
Tabela menu
CREATE TABLE IF NOT EXISTS `menu` (
`menuId` INT NOT NULL AUTO_INCREMENT ,
`menuNome` VARCHAR(45) NOT NULL ,
`menuIdPai` INT NOT NULL DEFAULT 0 ,
`menuLink` VARCHAR(45) NULL ,
PRIMARY KEY (`menuId`) )
ENGINE = InnoDB
Incluindo alguns valores.
INSERT INTO menu VALUES
(1, 'A Empresa', 0, 'empresa.php'),
(2, 'Sobre Nós', 1, 'sobre.php'),
(3, 'Objetivos', 1, 'objetivos.php'),
(4, 'Contato', 0, 'contato.php'),
(5, 'Produtos', 0, 'produtos.php'),
(6, 'Informática', 5, 'categoria.php?cat=informatica'),
(7, 'Missão da Empresa', 2, 'missao.php'),
(8, 'Visão da Empresa', 2, 'visao.php'),
(9, 'Televisão', 5, 'categoria.php?cat=televisao'),
(10, 'Computadores', 6, 'subcategoria.php?sub=computadores'),
(11, 'Monitores', 6, 'subcategoria.php?sub=monitores');
Codigo ateta2.php
<?php
/**
* Função imprimeMenuInfinito - Função recursiva utilizada para imprimir
* menu com submenus em níveis infinitos.
*
* @author MatiasRezende -
* @license http-~~-//creativecommons.org/licenses/by-sa/2.5/br/
* @param array $menuTotal - Array do menu a ser impresso
* @param $idPai - Id da categoria pai
*/
function imprimeMenuInfinito( array $menuTotal , $idPai = 0, $nivel = 0 )
{
// abrimos a ul do menu principal
echo str_repeat( "\t" , $nivel ),'<ul>',PHP_EOL;
// itera o array de acordo com o idPai passado como parâmetro na função
foreach( $menuTotal[$idPai] as $idMenu => $menuItem)
{
// imprime o item do menu
echo str_repeat( "\t" , $nivel + 1 ),'<li><a href="',$menuItem['link'],'">',$menuItem['name'],'</a>',PHP_EOL;
// se o menu desta iteração tiver submenus, chama novamente a função
if( isset( $menuTotal[$idMenu] ) ) imprimeMenuInfinito( $menuTotal , $idMenu , $nivel + 2);
// fecha o li do item do menu
echo str_repeat( "\t" , $nivel + 1 ),'</li>',PHP_EOL;
}
// fecha o ul do menu principal
echo str_repeat( "\t" , $nivel ),'</ul>',PHP_EOL;
}
$mysqli = new mysqli('localhost',' root','','Nome_Bco');
$query = $mysqli->query('SELECT * FROM menu ORDER BY menuIdPai');
while($row = $query->fetch_object())
{
$menuItens[$row->menuIdPai][$row->menuId] = array('link' => $row->menuLink,'name' => $row->menuNome);
}
imprimeMenuInfinito($menuItens);
link do forum
CREATE TABLE `agenda` (
`id` int(11) NOT NULL,
`nome` varchar(70) CHARACTER SET utf8 DEFAULT NULL,
`endereco` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
`bairro` varchar(30) CHARACTER SET utf8 DEFAULT NULL,
`cidade` varchar(30) CHARACTER SET utf8 DEFAULT NULL,
`estado` varchar(2) NOT NULL,
`ddd` varchar(2) DEFAULT NULL,
`telefone` varchar(15) DEFAULT NULL,
`celular` varchar(15) CHARACTER SET utf8 DEFAULT NULL,
`fone2` varchar(15) DEFAULT NULL,
`email` varchar(60) DEFAULT NULL,
`cep` varchar(9) DEFAULT NULL,
`contato` varchar(20) DEFAULT NULL,
`cnpj` varchar(18) DEFAULT NULL,
`nextel` varchar(15) DEFAULT NULL,
`contrato` varchar(1) DEFAULT NULL,
`obs` varchar(70) DEFAULT NULL,
`nr` decimal(10,2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
***************Cadastro , agenda86.php
<!DOCTYPE html>
<?php
$bd = 'mlcexpre_agua';
$conecta = ($GLOBALS["___mysqli_ston"] = mysqli_connect("localhost", "root" , "")) or die(mysqli_error($GLOBALS["___mysqli_ston"]));
$bd = mysqli_select_db($conecta, $bd) or die(mysqli_error($GLOBALS["___mysqli_ston"]));
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9">
<title>Cadastro Clientes</title>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<?php
class Agenda {
private $id;
private $nome;
private $email;
private $ddd;
private $telefone;
private $endereco;
private $cidade;
private $estado;
public function cadastro($nome, $email, $ddd, $telefone,$endereco,$cidade, $estado ) {
$this->nome = $nome;
$this->email = $email;
$this->ddd = $ddd;
$this->telefone = $telefone;
$this->endereco = $endereco;
$this->cidade = $cidade;
$this->estado = $estado;
$sql_cadastro = mysqli_query($GLOBALS["___mysqli_ston"], "INSERT INTO Agenda SET nome = '$this->nome', email = '$this->email', ddd= '$this->ddd', telefone = '$this->telefone' ,endereco='$this->endereco', cidade='$this->cidade',estado='$this->estado' ");
echo '<meta http-equiv="refresh" content="0; url=agenda86.php"';
}
public function edita($id, $nome, $email,$ddd, $telefone,$endereco,$cidade, $estado ) {
$this->id = $id;
$this->nome = $nome;
$this->email = $email;
$this->ddd = $ddd;
$this->telefone = $telefone;
$this->endereco = $endereco;
$this->cidade = $cidade;
$this->estado = $estado;
$sql_editar = mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE Agenda SET nome = '$this->nome', email = '$this->email', ddd= '$this->ddd', telefone = '$this->telefone', endereco='$this->endereco', cidade='$this->cidade',estado='$this->estado' WHERE id = $this->id");
echo '<meta http-equiv="refresh" content="0; url=agenda86.php"';
}
public function deleta ($id) {
$this->id = $id;
$qry_del = mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM Agenda WHERE id = $this->id");
echo"
<script type='text/javascript'>
alert(' Registro excluido com sucesso ');
window.location='agenda86.php';
</script>
";
}
}
$agenda = new Agenda;
if(@$_GET['pg'] == 'altera') {
if(!empty($_GET['cod'])) {
$id = $_GET['cod'];
$sql_edita = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM Agenda WHERE id = $id");
$res = mysqli_fetch_array($sql_edita);
?>
<h2>Alterar Clientes </h2>
<?php if(@$_POST['enviar'] == 'Gravar'){
$nome = $_POST['nome'];
$email = $_POST['email'];
$ddd = $_POST['ddd'];
$telefone = $_POST['telefone'];
$endereco = $_POST ["endereco"];
$cidade = $_POST ["cidade"];
$estado = $_POST ["estado"];
$agenda->edita($id, $nome, $email, $ddd, $telefone, $endereco, $cidade, $estado);
}
echo '
<div style="float: left;">
<form action="" enctype="multipart/form-data" name="Gravar" method="post" >
<fieldset style="background-color: #E9ECF5 ; color:#FFFFF; font-size: 18px;" >
<label> Nome: </label> <input type="text" name="nome" size="70" maxlength="60" value="' .$res['nome']. ' "/> <br>
<label> Email: </label> <input type="text" name="email" size="70" maxlength="60" value="' .$res['email']. ' "/><br>
<label> Ddd: </label> <input type="text" name="ddd" size="4" maxlength="2" value="' .$res['ddd']. ' "/><br>
<label> Telefone: </label> <input type="text" name="telefone" value="' .$res['telefone']. ' "/> <br>
<label> Endereco: </label> <input type="text" name="endereco" size="70" maxlength="70" value="' .$res['endereco']. ' " /> <br>
<label> Cidade: </label> <input type="text" name="cidade" size="20" maxlength="20" value="' .$res['cidade']. ' " /> <br>
<tr>
<td>Estado:</td>
<td><select name="estado" >
<option value="SP">SP</option>
<option value="TO">TO</option>
</select>
<span class="style1">* </span></td>
</tr>
<input type="submit" name="enviar" value="Gravar" />
<a type="button" value="Sair" class="btn btn-warning" href="agenda86.php">Cancela</a>
<a type="button" class="btn btn-info pull-left" onclick="return confirm();" href="agenda86.php?pg=deleta&cod='.$res["id"].'"> Deleta </a>
</form>
</fieldset>
</div>
<p style="margin-bottom: 2800px;"></p>
';
}
}
?>
<?php
if(@$_GET['pg'] == 'novo') {
echo ' <h2>Incluir NOVO CLIENTE </h2> ';
if(@$_POST['enviar'] == 'Cadastrar'){
$nome = $_POST['nome'];
$email = $_POST['email'];
$ddd = $_POST['ddd'];
$telefone = $_POST['telefone'];
$endereco = $_POST ["endereco"];
$cidade = $_POST ["cidade"];
$estado = $_POST ["estado"];
$agenda->cadastro($nome, $email, $ddd, $telefone,$endereco,$cidade,$estado );
}
echo '
<div style="float: left;">
<form action="" enctype="multipart/form-data" name="Gravar" method="post" >
<fieldset style="background-color: #E9ECF5 ; color:#FFFFF; font-size: 18px;" >
<label> Nome: </label> <input type="text" name="nome" size="70" maxlength="60" /> <br>
<label> Email: </label> <input type="text" name="email" size="70" maxlength="60"/> <br>
<label> Ddd: </label> <input type="text" name="ddd" /> <br>
<label> Telefone: </label> <input type="text" name="telefone" /> <br>
<label> Endereco: </label> <input type="text" name="endereco" size="70" maxlength="60" /> <br>
<label> Cidade: </label> <input type="text" name="cidade" /> <br>
<tr>
<td>Estado :</td>
<td><select name="estado" >
<option value="SP">SP</option>
<option value="TO">TO</option>
</select>
<span class="style1">* </span></td>
</tr>
<input type="submit" name="enviar" value="Cadastrar" />
<a style="background-color:#CEF6D8; color:#fffff; " type="button" class="btn btn-info" href="agenda86.php">Cancela</a>
</fieldset>
</form>
</div>
<p style="margin-bottom: 12800px;"></p>
';
}
if(@$_GET['pg'] == 'deleta') {
if(!empty($_GET['cod'])) {
$id = $_GET['cod'];
$agenda->deleta($id);
}
}
?>
<div class='container'>
<form name="pesquisa" action="agenda82.php" method="get" id='form-contato' class="form-horizontal col-md-10">
<label class="col-md-2 control-label" >Cliente Pesquisa</label>
<div class='col-md-7'>
<input type="text" class="form-control" name="pesq" placeholder="Infome o Nome ">
</div>
<input type="submit" value="Busca" class="btn btn-primary"/>
<input type="button" value="Sair" class="btn btn-primary" onclick="window.location.href='index2.php';" />
</form>
<!-- Link para página de cadastro -->
<div class='clearfix'></div>
<?
@$pesq = @$_GET["pesq"];
?>
<table align="center" border="1" cellpadding="4" cellspacing="0"
width="80%">
<tbody>
<th style="background-color:#53CEDF; color:#fff; font-size: 12px;" colspan="10" href="agenda86.php?pg=novo" >Cadastro de Clientes </th>
<th style="background-color:#53CEDF; color:#fffff;" colspan="10"> <a href="agenda86.php?pg=novo" title="Adiciona" ><strong> Cliente</strong></a> </th>
<tr align="center">
<td bgcolor="#CEF6F5" align="left" width="8%">Id</td>
<td bgcolor="#CEF6F5" align="left" width="25%">Nome</td>
<td bgcolor="#CEF6F5" align="left" width="25%">Endereco</td>
<td bgcolor="#CEF6F5" align="left" width="25%">Cidade</td>
<td bgcolor="#CEF6F5" align="left" width="8%">UF</td>
<td bgcolor="#CEF6F5" align="left" width="25%">Email</td>
<td bgcolor="#CEF6F5" align="left" width="8%">Ddd</td>
<td bgcolor="#CEF6F5" align="left" width="25%">Telefone</td>
<td bgcolor="#CEF6D8"><input type="button" onclick="window.location.href='agenda86.php?pg=novo';" value="Incluir" title="Adiciona" > </td>
<td bgcolor="#F6CEE3"><input type="button" onclick="window.location.href='index2.php';" value="Sair"/> </td>
<td bgcolor="#CEF6D8"><input type="button" value="Imprime" onclick="javascript:window.print();" title="Imprimir" > </td>
</tr>
</tbody>
<?php
if ( !empty($pesq)) {
$qry =mysqli_query( $conecta , "SELECT * FROM Agenda WHERE nome LIKE '%".$pesq."%' order by nome " ) or die(mysqli_error($GLOBALS["___mysqli_ston"]));
}
else {
$qry =mysqli_query($conecta, "SELECT * FROM Agenda order by nome") or die(mysqli_error($GLOBALS["___mysqli_ston"]));
}
while($resultado=mysqli_fetch_array($qry)) { ?>
<tr>
<td><?php echo $resultado["id"]; ?></td>
<td><?php echo $resultado["nome"]; ?></td>
<td><?php echo $resultado["endereco"]; ?></td>
<td><?php echo $resultado["cidade"]; ?></td>
<td><?php echo $resultado["estado"]; ?></td>
<td><?php echo $resultado["email"]; ?></td>
<td><?php echo $resultado["ddd"]; ?></td>
<td><?php echo $resultado["telefone"]; ?></td>
<td><a style="background-color:#CEF6D8; color:#fffff; " href="agenda86.php?pg=altera&cod=<?php echo $resultado["id"]; ?>">Editar</a></td>
<td><a href="agenda86.php?pg=deleta&cod=<?php echo $resultado["id"];?>"><font color="#5858FA">Del</font></a></td>
</tr>
<?php
}
echo '</table>';
?>
</body>
</html>
**** dropdow com 2 itens no menu
<li class="nav-item">
<div class="dropdown show">
<a class="btn btn-info dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Produto</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<a class="dropdown-item" href="estoque.php">Estoque</a>
<a class="dropdown-item" href="categoria.php">Categoria</a>
</div>
</div>
<!-- fim dropdown com dois itens no menu
Exemplo 1:
1
2
3
$a = "1234";
$b = number_format($a, 2, ',', '.');
echo "$b";
Resultado:
Exemplo 2:
1
2
3
4
5
$a = "160,20";
$b = "3";
$conta = $a / $b;
$conta2 = number_format($conta, 2, ',', '.');
echo "R$ $conta <br /> R$ $conta2";
Resultado:
1
2
R$ 53.333333333333
R$ 53,33
Nesse exemplo fiz um cálculo dividindo a variável $a pela $b
Explicando:
2 -> número de casas…
, -> separador decimal
. -> separador de milhar
Obs:
Caso você tenha problemas em fazer cálculos com números milhares tente isso:
1
2
3
4
5
$a = "15.000,000";
$b = 3;
$calculo = str_replace(".","",$a) / $b;
$calculo = number_format($calculo, 2, ',', '.');
echo "R$ $calculo";
Resultado:
Agora o mesmo código sem o replace…
1
2
3
4
5
$a = "15.000,000";
$b = 3;
$calculo = $a / $b;
$calculo = number_format($calculo, 2, ',', '.');
echo "R$ $calculo";
Resultado:
No tutorial anterior sobre
Paginação PHP aprendemos de uma forma bem simplificada a criação de um script de paginação. Vamos agora estender um pouco mais nosso código e incluir a opção dos botões
anterior e
próximo para tornar a navegação mais dinâmica.
Utilize o mesmo código e altere a parte do código abaixo do comentário: //exibe a paginação por esse:
1
2
3
4
5
6
7
8
9
10
11
12
13
if($pagina > 1) {
echo "<a href='index.php?pagina=".($pagina - 1)."' class='controle'>« anterior</a>";
}
for($i = 1; $i < $numPaginas + 1; $i++) {
$ativo = ($i == $pagina) ? 'numativo' : '';
echo "<a href='index.php?pagina=".$i."' class='numero ".$ativo."'> ".$i." </a>";
}
if($pagina < $numPaginas) {
echo "<a href='index.php?pagina=".($pagina + 1)."' class='controle'>proximo »</a>";
}
Note que temos agora dois condicionais IF, um no começo que verifica se a página atual é maior que 1 e outro no final que verifica se a página atual é menor que o número de páginas.
Também incluímos uma nova variável chamada $ativo que verifica qual a página ativa no momento e insere uma classe para podermos estilizar o CSS e destacar a página atual. E já que estamos fazendo esta inclusão de classe, segue um código pronto para ser inserido como estilo da página:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<style>
.numero{
text-decoration: none;
background: #2A85B6;
text-align: center;
padding: 3px 0;
display: block;
margin: 0 2px;
float: left;
width: 20px;
color: #fff;
}
.numero:hover, .numativo, .controle:hover{
background: #1B3B54;
}
.controle{
text-decoration: none;
background: #2A85B6;
text-align: center;
padding: 3px 8px;
display: block;
margin: 0 3px;
float: left;
color: #fff;
}
</style>
Espero que seja útil pra você.
table ou grid Integrar Bootstrap CodeIgniter video
GetBootstrap css para php Framework codeigenit er
Busca de cep em php Mais busca de cep em php PAGINACAO
formulário com múltiplas tabelas Curso html5 Wamp
Backup em php que funciona
Datatable com bootstrap
menu dropdown
Redirecionar a pagina, ou chamar uma pagina anterior
echo "<script>location.href='index.php';</script>";
BLOG ERRO COM CHARSET EM PHP NUNCA MAIS
pCodigo de Paginacao em php Video sobre paginacao em PHP Video 2
informar valores menores que 1 e maiores que 12.
<div class="input-group input-group-sm col-xs-3">
<span class="input-group-addon" id="sizing-addon3"> Qtde. </span>
<input type="number" class="form-control" aria-describedby="sizing-addon3"
name="qtd" value="1" max="12" min="1" >
</div>
No caso é preciso alterar de text para number.
<input type="number " name="nome_do_campo" max="100" >
jotform form editor online vídeo
Site http://www.jotform.com/
editor online gera o resultado
PASTEBIN ENVIAR CODIGOS VIA FORUM
Botoes 3d php
Adiconar e Excluir em 1 unico PHP ou Otro
LOGIN PHP
CODIGO
FIXAR TH DA TABLE PRIMEIRA LINHA DA TABELA PHP
no css
tr : first-child {
background : #0099FF ;
position : fixed ;
}
Video botões 3d php
Método Post e Método Get Php
Mais cores
chamar o formulário automaticamente
css para form php Csv php
CSS PARA TABELAS PHP
consulta do cnpj Datas PHP
Relaciion entra tabelas mysql phpmyadmin
mais relacionamento forekey, chave estragenira cascate altera
r myway.com.br
cores html
ip da maquina
Liberando ip no cpanel mysql remota % % % %
Video alterando mysqlremoto compartilhar o ip
Hospedagem Anual com br, barata 3 sites por 50.00
campo blob mysql imagens
nslookup google.com.br
ping google.com.br traz o IP do site
cusrso completo 25 aulas
1 SELECT id,nome FROM `funciona` ORDER BY `id` ASC,`nome` DESC;
2 SELECT id,nome FROM `funciona` ORDER BY `id` DESC,`nome` DESC;
códigos em PHP Logomarca1 Logomarca2
Relacionamento tabelas PHP
https://byet.host/ Jform formularios como fazer
sites hospedagem grátis vídeo hospedagem
TESTES
Link do programa que vamos usar:
http://audacity.sourceforge.net/?lang...
Vídeo Ensina como Fazer o site de musicas
https://www.youtube.com/watch?v=BruM0ExQnek
MENU SUB MENU HTML
CEP EM PHP
menu horizontal com ícones
Video como instalar a Os Video2
ordem de servico
Ordem de serviços
boleto bancário em php Boleto bancário groups Video
Teclas de atalho windows 10
F4 = Abre a listinha da barra de endereços.
F5 = Atualiza a janela atual.
F6 = Seleciona o texto da barra de endereços.
ALERT EM PHP
echo '<script type="text/javascript">
alert("Consulta adicionada!");
window.location.href="../agendar/condutor1.php";
</script>';
phpMaker
Colando Menu fixo no blog
Inagens de links em html no site
Contador de Visitas no blog link
video do Menu fixo do blog
Menu e layout responsivo
Código de busca de Cep em PHP
<?php
@$cep = $_POST['cep'];
function buscaCep($cep) {
global $retorno;
$cep = preg_replace("/[^0-9]/", "", $cep);
$resultado=file_get_contents(" http://republicavirtual.com.br/web_cep.php?cep=$cep&formato=query_string ");
$logradouro= urldecode($resultado);
// echo "<br/>";
$logradouro= parse_str($resultado,$retorno);
// print_r($retorno);
return $retorno;
}
buscacep($cep);
?>
<hr />
<form method="post" action="">
<fieldset style="background-color: #E9ECF5 ; color:#FFFFF; font-size: 16px; width: 680px;" >
Cep <input type="text" name="cep" id="cep" onblur="buscacep();" autofocus SIZE = "8" maxlength="8" />
<input type="submit" name="buscacep();" value="Buscar" /> <br>
<label> Endereco: </label> <input type="text" name="endereco" value="<?php
echo $retorno['tipo_logradouro'] ." ". $retorno['logradouro']; ?>" SIZE = "100" maxlength="100" /><br>
<label> Bairro : <label> <input type="text" name="bairro" value="<?php
echo $retorno['bairro']; ?>" /><br>
<label> Cidade : <label> <input type="text" name="cidade" value="<?php
echo utf8_encode($retorno['cidade']); ?>" /><br>
<label> Estado : <label> <input type="text" name="estado" value="<?php
echo $retorno['uf']; ?>" /><br>
<label> Cep : <label>
<?php
echo $cep ;
?>
</fieldset>
</form>
****Outra forma****
<?php
function get_endereco($cep){
// formatar o cep removendo caracteres nao numericos
$cep = preg_replace("/[^0-9]/", "", $cep);
$url = " http://viacep.com.br/ws/$cep/xml/ ";
$xml = simplexml_load_file($url);
return $xml;
}
$endereco = (get_endereco("05093-000"));
$bairro = (get_endereco("05093-000"));
$uf = (get_endereco("05093-000"));
$localidade = (get_endereco("05093-000"));
echo "$endereco->logradouro";
echo ": $bairro->bairro";
echo ": $uf->uf";
echo ": $localidade->localidade";
?>
<hr />
<form method="post" action="">
Endereco: <input type="text" name="endereco" value="<?php echo $endereco->logradouro; ?>" /> </input> <br/>
<label> Bairro : <label> <input type="text" name="bairro" value="<?php
echo $bairro->bairro; ?>" /><br>
Cidade: <input type="text" name="cidade" value="<?php echo $localidade->localidade; ?>" /> </input> <br/>
</form>
http://www.zerobugs.com.br/baixar/pegar-endereco-completo-atraves-cep-php-correios
***************
Retornar valor de varios campos com php e javascript
function pesquisaproduto($id){
include 'conecta.php';
$sql = "SELECT * from produtos where id_produto = " . $id . ""; // busca todos os campos
$retorno = array();
$consulta = mysql_query($sql, $conexao);
if ($consulta != "0"){
$consulta = mysql_fetch_array($consulta);
$retorno = $consulta; // irá retornar todos os campos
}
return json_encode($retorno); // retorna em formato json
}
**********
function pesquisacliente(cpfcli) {
if (cpfcli != ""){
$.post('buscacliente.php',{cpfcli: cpfcli}, function (data){
//alert($('#razao').html(data));
$("input[name='nomecliente']").val(data.descricao);
},"json");
}
};
****
ou pesquisa todos
function buscaTodos(){
include 'conecta.php';
$sql = "SELECT * from produtos"; // busca TODOS os produtos
$registros = array();
$busca = mysql_query($sql, $conexao);
while ($x = mysql_fetch_array($busca)) {
$registros[] = $x; // adiciona essa 'linha' ao vetor de registros
}
return json_encode($retorno); // retorna em formato json
}
jQuery:
function pesquisaTodos() {
$.post('buscacliente.php', {}, function (data){
alert(data[0].descricao); // descrição da primeira linha do seu select
alert(data[1].descricao); // descrição da 2ª linha do seu select
},"json");
};
MASCARA PHP
<html>
<head>
<link href="login.css" rel="stylesheet" type="text/css" />
<title>CADASTRO</title>
<script type="text/javascript">
function formatar_mascara(src, mascara) {
var campo = src.value.length;
var saida = mascara.substring(0,1);
var texto = mascara.substring(campo);
if(texto.substring(0,1) != saida) {
src.value += texto.substring(0,1);
}
}
</script>
</head>
<body>
<form action="#" method="post">
CPF:<input name="cpf" method="post" maxlength="14" size="40"
onkeypress="formatar_mascara(this,'###.###.###-##')" type="text">
CEP:<input name="cep" method="post" maxlength="11" size="40"
onkeypress="formatar_mascara(this,'##.###-###')" type="text">
Fone:<input name="fone" method="post" maxlength="12" size="40"
onkeypress="formatar_mascara(this,'##-####-####')" type="text">
</form>
</body>
</html>
****
Nenhum comentário:
Postar um comentário