I made a modal so that it was possible to see the history of each client.
I'm having trouble pulling cod_cliente
to show its history.
File where you have Modal:
<?php
include ("Config.php");
$consulta = mysql_query("SELECT * FROM clientes ORDER BY nome;");
$total = mysql_num_rows($consulta);
?>
</head>
<body>
<div class="row">
<div class="col-md-10">
<div class="col-sm-offset-1">
<table class="table table-striped">
<tr>
<h1>
<th>Opção </th>
<th>Cliente</th>
<th>Celular</th>
<th>Telefone</th>
<th>Email</th>
</h1>
</tr>
<?php
while($l = mysql_fetch_array($consulta)) {
$COD_CLIENTE = $l["COD_CLIENTE"];
$NOME = $l["NOME"];
$CELULAR = $l["CELULAR"];
$TELEFONE = $l["TELEFONE"];
$EMAIL = $l["EMAIL"];
echo "
<tr>
<td><a href=\"editar_cliente.php?COD_CLIENTE=$COD_CLIENTE\">[Editar] </a>
<a href=\"excluir_cliente.php?COD_CLIENTE=$COD_CLIENTE\"> [Excluir] </a> "; ?>
**<button onclick="$('#modal-container').load('historico.php?COD_CLIENTE<?=$COD_CLIENTE?>', function(){$('#modal').modal('show');})">Histórico</button>
<div id="modal-container"></div>**
</td>
<td> $NOME</td>
<td> $CELULAR</td>
<td> $TELEFONE</td>
<td> $EMAIL</td>
</tr>\n";
}
?>
</table>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><!--Includeallcompiledplugins(below),orincludeindividualfilesasneeded--><scriptsrc="C:\xampp\htdocs\SALAO\bootstrap/js/bootstrap.min.js"></script>
<script src="C:\xampp\htdocs\SALAO\bootstrap/js/bootstrap.js"></script>
<script src='http://code.jquery.com/jquery-2.1.3.min.js'></script>
<script src='//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js'>
</script>
<!-- necessary scripts for the dialog -->
<link rel="stylesheet"
href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
Thisisthefilehistorico.php:
<?php$COD_CLIENTE=$_GET["COD_CLIENTE"];
include ("Config.php");
$re2 = mysql_query("SELECT salao.clientes.NOME 'cliente_nome', salao.procedimentos.NOME, salao.agenda.DATA
FROM salao.agenda
INNER JOIN procedimentos ON procedimentos.COD_PROCEDIMENTOS = agenda.COD_PROCEDIMENTOS
INNER JOIN clientes ON clientes.COD_CLIENTE = agenda.COD_CLIENTE
where clientes.COD_CLIENTE = $COD_CLIENTE
ORDER BY agenda.data");
$total2 = mysql_num_rows($re2);
?>
<div class="modal fade" id="modal" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×
</button>
<h4 class="modal-title">Histórico</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-10">
<div class="col-sm-offset-1">
<table id= "contact_form" class="table table-striped">
<tr>
<th>Procedimentos</th>
<th>Data</th>
</tr>
<?php
while($l2 = mysql_fetch_array($re2)) {
$procedimentos = $l2[1];
$data = $l2["DATA"];
echo "
<tr>
<td> $procedimentos</td>
<td> ";
echo date('d/m/Y', strtotime($data));
echo "
</td>
</tr>\n";
}
?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><!--Includeallcompiledplugins(below),orincludeindividualfilesasneeded--><scriptsrc="C:\xampp\htdocs\SALAO\bootstrap/js/bootstrap.min.js"></script>
<script src="C:\xampp\htdocs\SALAO\bootstrap/js/bootstrap.js"></script>
<script src='http://code.jquery.com/jquery-2.1.3.min.js'></script>
<script src='//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js'>
</script>
<!-- necessary scripts for the dialog -->
<link rel="stylesheet"
href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script><scriptsrc="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js">
</script>
</body>
</html>