Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Prezados boa tarde,
Estou tentando escrever na tela o resultado de um select na tela utilizando WHILE, porém está entrando em loop infinito e gostaria de ajuda para acertar a sintaxe desta técnica.
Código apenas com 1 WHILE
<?php
$_SESSION['DB_base'] = 'tupa';
$_SESSION['table_base'] = 'people_records';
$query_Recordset2 = "SELECT * FROM {$_SESSION['table_base']} WHERE `link_record` = {$data1['id']} AND `record_caracter_id` = 1 order by {$_SESSION['id_base']} DESC";
$Recordset2 = mysqli_query($connect, $query_Recordset2) or die(mysqli_error($connect));
$row_Recordset2 = mysqli_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysqli_num_rows($Recordset2);
while($Recordset2 = mysqli_fetch_assoc($Recordset2)) {
echo "Contato: ".$Recordset2["name"]."</br>";
echo "CPF/CNPJ: ".$Recordset2["cpf_cnpj"]."</br>";
echo "e-mail: ".$Recordset2["email"]."</br>";
echo "Celular: ".$Recordset2["cellphone"]."</br>";
echo "Telefone: ".$Recordset2["telephone"]."</br>";
echo "Documento de identificação: ".$Recordset2["name"]."</br>";
echo "</br>";
}?>
Código inteiro:
<?php
session_start();
$_SESSION['last_page'] = $_SERVER['PHP_SELF'];
$_SESSION['del_message'] = 'Deseja excluir o cliente ';
$_SESSION['DB_base'] = 'tupa';
$_SESSION['table_base'] = 'people_records';
$_SESSION['id_base'] = 'id';
require_once('connections.php');
$query_Recordset1 = "SELECT * FROM {$_SESSION['table_base']} WHERE record_caracter_id = '0' order by {$_SESSION['id_base']} DESC";
$Recordset1 = mysqli_query($connect, $query_Recordset1) or die(mysql_error());
$row_Recordset1 = mysqli_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysqli_num_rows($Recordset1);
?>
<!doctype html>
<html lang='pt-br'>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tupã - Serviços de Engenharia</title>
<link href='css/sistema.css' rel='stylesheet' type='text/css'
media='all'>
<style type="text/css">
#cnpj {
display: none;
}
#contato {
display: none;
}
#endereco {
display: none;
}
</style>
</head>
<body>
<fieldset>
<legend>Gerenciamento de Clientes</legend>
<table id="tabela">
<thead>
<tr>
<th>Descrição</th>
<th>Contato</th>
<th>Projetos</th>
<th colspan="3">Ação</th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th colspan="3"><input type="submit" value="Filtrar" /> | <input
type="button" onclick="javascript: location.href='#rec_openModal'"
value="Adicionar" /></th>
</tr>
</thead>
<?php while ($Recordset1 = $row_Recordset1){?>
<tr>
<td bgcolor="#F5F5F5"><p>
Código:
<?php echo $Recordset1['id']; ?>
<br /> Cliente:
<?php echo $Recordset1['name']; ?>
<br /> CPF/CNPJ:
<?php echo $Recordset1['cpf_cnpj']; ?>
<br /> e-mail:
<?php echo $Recordset1['email']; ?>
<br /> Celular:
<?php echo $Recordset1['cellphone']; ?>
<br /> Telefone:
<?php echo $Recordset1['telephone']; ?>
<br /> Documento de identificação:
<?php
if(file_exists('imagens/clients/energy_bill/'.$Recordset1['id'].'.jpg'))
{
echo 'Documento de identificação: <a href=imagens/clients/energy_bill/'.$Recordset1['id'].'.jpg target="_blank"><img src="imagens/view.png" width="24" height="24">';
}
else
{
echo 'Documento de identificação: indisponível';
}
?>
</p></td>
<td bgcolor="#F5F5F5"><?php
$_SESSION['DB_base'] = 'tupa';
$_SESSION['table_base'] = 'people_records';
$query_Recordset2 = "SELECT * FROM {$_SESSION['table_base']} WHERE `link_record` = {$data1['id']} AND `record_caracter_id` = 1 order by {$_SESSION['id_base']} DESC";
$Recordset2 = mysqli_query($connect, $query_Recordset2) or die(mysqli_error($connect));
$row_Recordset2 = mysqli_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysqli_num_rows($Recordset2);
while($Recordset2 = mysqli_fetch_assoc($Recordset2)) {
echo "Contato: ".$Recordset2["name"]."</br>";
echo "CPF/CNPJ: ".$Recordset2["cpf_cnpj"]."</br>";
echo "e-mail: ".$Recordset2["email"]."</br>";
echo "Celular: ".$Recordset2["cellphone"]."</br>";
echo "Telefone: ".$Recordset2["telephone"]."</br>";
echo "Documento de identificação: ".$Recordset2["name"]."</br>";
echo "</br>";
}?>
</td>
<td bgcolor="#F5F5F5"><?php
$_SESSION['DB_base'] = 'tupa';
$_SESSION['table_base'] = 'projects_link_tpm';
$query_Recordset3 = "SELECT * FROM {$_SESSION['table_base']} where people_record_id = {$row_Recordset1['id']} order by {$_SESSION['id_base']} DESC";
$Recordset3 = mysqli_query($connect, $query_Recordset3) or die(mysqli_error($connect));
$row_Recordset3 = mysqli_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysqli_num_rows($Recordset3);
while($data3 = mysqli_fetch_assoc($Recordset3)) {
echo "Projeto: ".$Recordset3["id"]."</br>";
echo "</br>";
}?>
</td>
<td width="3%" bgcolor="#F5F5F5"><form
action="mysql/update_process.php" method="POST">
<input type="hidden" name="update_process"
value="<?php echo $row_Recordset1[$_SESSION['id_base']] ?>"> <input
type="image" name="submit" src="imagens/edit.png" width="24"
height="24">
</form></td>
<td bgcolor="#F5F5F5"><form action="mysql/del_process.php"
method="POST">
<input type="hidden" name="delete_process"
value="<?php echo $row_Recordset1[$_SESSION['id_base']] ?>"> <input
type="hidden" name="delete_register"
value="<?php echo $row_Recordset1['name'] ?>"> <input
type="image" name="submit" src="imagens/delete.png" width="24"
height="24">
</form></td>
</tr>
<?php }?>
</table>
</fieldset>
<div id="rec_openModal" class="modalDialog">
<div>
<a class="close" title="Fechar" href="#close">X</a>
<fieldset>
<legend>Realizar cadastro</legend>
<br> <label>Modalidade:</label> <select name="modality"
onChange="mostraDiv(this.value)">
<option value="1">Cliente CPF</option>
<option value="2">Cliente CNPJ</option>
<option value="3">Contato de cliente</option>
<option value="4">Endereço de cliente</option>
</select> <br />
<div id="cpf">
<form action="mysql/insert_process.php" method="post" id='1'>
<br> <label>Nome: </label> <input name='name' type='text' /><br />
<br> <label>CPF: </label> <input name='cpf_cnpj' type='number'
data-mask='000.000.000-00' /><br /> <br> <label>e-mail: </label>
<input name='email' type='text' /><br /> <br> <label>Celular: </label>
<input name='cellphone' type='text' data-mask="(00)0000-0000" /><br />
<br> <label>Telefone: </label> <input name='telephone' type='text'
data-mask='(00)00000-0000' autocomplete='off' /><br /> <br> <label>Documento
de identificação: </label> <input type='file' name='doc_id'><br />
<INPUT TYPE="hidden" NAME="record_caracter_id" VALUE="0"><INPUT
TYPE="hidden" NAME="action" VALUE="0"> <br> <label><input
type="submit" value="Cadastrar" /> </label><br />
</form>
</div>
<div id="cnpj">
<form action="mysql/insert_process.php" method="post" id='2'>
<br> <label>Nome da empresa: </label> <input name='name'
type='text' /><br /> <br> <label>CNPJ: </label> <input
name='cpf_cnpj' type='text' data-mask="00.000.000/0000-00" /><br />
<br> <label>e-mail: </label> <input name='email' type='email' /><br />
<br> <label>Celular: </label> <input name='cellphone' type='text'
data-mask="00000-000" /><br /> <br> <label>Telefone: </label> <input
name='telephone' type='text' /><br /> <br> <label>Documento de
identificação: </label> <input name='doc_id' type='file' /><br />
<INPUT TYPE="hidden" NAME="record_caracter_id" VALUE="0"><INPUT
TYPE="hidden" NAME="action" VALUE="0"> <br> <label><input
type="submit" value="Cadastrar" /> </label><br />
</form>
</div>
<div id="contato">
<form action="mysql/insert_process.php" method="post" id='3'>
<br> <label>Nome: </label> <input name='name' type='text' /><br />
<br> <label>cpf: </label> <input name='cpf' type='number'
data-mask='000.000.000-00' /><br /> <br> <label>e-mail: </label>
<input name='email' type='text' /><br /> <br> <label>Celular: </label>
<input name='cellphone' type='text' data-mask="(00)0000-0000" /><br />
<br> <label>Telefone: </label> <input name='telephone' type='text'
data-mask='(00)00000-0000' autocomplete='off' /><br /> <br> <label>Documento
de identificação: </label> <input type='file' name='doc_id'><br />
<INPUT TYPE="hidden" NAME="record_caracter_id" VALUE="1"><br> <label>Contato
do cliente </label> <select name="link_record">
<?php
while ($data = mysqli_fetch_array($Recordset1)) {
echo("<option value='".$data['id']."'>".$data['name']."</option>");
}
?>
</select><br /> <INPUT TYPE="hidden" NAME="action" VALUE="0"> <br>
<label><input type="submit" value="Cadastrar" /> </label><br />
</form>
</div>
<div id="endereco">
<form action="mysql/insert_process.php" method="post" id='4'>
<br> <label>CEP: </label> <input name='cep' type='text' /><br /> <br>
<label>Logradouro: </label> <input name='address' type='text'
data-mask="00000-000" autocomplete="off" /><br /> <br> <label>Número:
</label> <input name='number' type='text' /><br /> <br> <label>Bairro:
</label> <input name='neighborhood' type='text' /><br /> <br> <label>Cidade/UF:
</label> <input name='city' type='text' /><input name='uf'
type='text' /><br /> <INPUT TYPE="hidden"
NAME="record_caracter_id" VALUE="4"><INPUT TYPE="hidden"
NAME="action" VALUE="1"> <br> <label><input type="submit"
value="Cadastrar" /> </label><br />
</form>
</div>
</fieldset>
</div>
</div>
</body>
</html>
<?php
mysqli_free_result($Recordset1);
mysqli_free_result($Recordset2);
mysqli_free_result($Recordset3);
?>Não funcionou Marcos. Ainda está em loop infinito.
Trecho com while
<?php
$_SESSION['DB_base'] = 'tupa';
$_SESSION['table_base'] = 'people_records';
$query_Recordset2 = "SELECT * FROM {$_SESSION['table_base']} WHERE `link_record` = {$row_1['id']} AND `record_caracter_id` = 1 order by {$_SESSION['id_base']} DESC";
$Recordset2 = mysqli_query($connect, $query_Recordset2) or die(mysqli_error($connect));
while($row_2 = mysqli_fetch_assoc($Recordset2)) {
echo "Contato: ".$row_2["name"]."</br>";
echo "CPF/CNPJ: ".$row_2["cpf_cnpj"]."</br>";
echo "e-mail: ".$row_2["email"]."</br>";
echo "Celular: ".$row_2["cellphone"]."</br>";
echo "Telefone: ".$row_2["telephone"]."</br>";
echo "Documento de identificação: ".$row_2["name"]."</br>";
echo "</br>";
}?>
Código inteiro:
<?php
session_start();
$_SESSION['last_page'] = $_SERVER['PHP_SELF'];
$_SESSION['del_message'] = 'Deseja excluir o cliente ';
$_SESSION['DB_base'] = 'tupa';
$_SESSION['table_base'] = 'people_records';
$_SESSION['id_base'] = 'id';
require_once('connections.php');
$query_Recordset1 = "SELECT * FROM {$_SESSION['table_base']} WHERE record_caracter_id = '0' order by {$_SESSION['id_base']} DESC";
$Recordset1 = mysqli_query($connect, $query_Recordset1) or die(mysql_error());
$row_Recordset1 = mysqli_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysqli_num_rows($Recordset1);
?>
<!doctype html>
<html lang='pt-br'>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tupã - Serviços de Engenharia</title>
<link href='css/sistema.css' rel='stylesheet' type='text/css'
media='all'>
<style type="text/css">
#cnpj {
display: none;
}
#contato {
display: none;
}
#endereco {
display: none;
}
#projeto {
display: none;
}
</style>
</head>
<body>
<fieldset>
<legend>Gerenciamento de Clientes</legend>
<table id="tabela">
<thead>
<tr>
<th>Descrição</th>
<th>Contato</th>
<th>Projetos</th>
<th colspan="3">Ação</th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th colspan="3"><input type="submit" value="Filtrar" /> | <input
type="button" onclick="javascript: location.href='#rec_openModal'"
value="Adicionar" /></th>
</tr>
</thead>
<?php while ($row_1 = $row_Recordset1){?>
<tr>
<td bgcolor="#F5F5F5"><p>
Código:
<?php echo $row_1['id']; ?>
<br /> Cliente:
<?php echo $row_1['name']; ?>
<br /> CPF/CNPJ:
<?php echo $row_1['cpf_cnpj']; ?>
<br /> e-mail:
<?php echo $row_1['email']; ?>
<br /> Celular:
<?php echo $row_1['cellphone']; ?>
<br /> Telefone:
<?php echo $row_1['telephone']; ?>
<br /> Documento de identificação:
<?php
if(file_exists('imagens/clients/energy_bill/'.$row_1['id'].'.jpg'))
{
echo 'Documento de identificação: <a href=imagens/clients/energy_bill/'.$row_1['id'].'.jpg target="_blank"><img src="imagens/view.png" width="24" height="24">';
}
else
{
echo 'Documento de identificação: indisponível';
}
?>
</p></td>
<td bgcolor="#F5F5F5"><?php
$_SESSION['DB_base'] = 'tupa';
$_SESSION['table_base'] = 'people_records';
$query_Recordset2 = "SELECT * FROM {$_SESSION['table_base']} WHERE `link_record` = {$row_1['id']} AND `record_caracter_id` = 1 order by {$_SESSION['id_base']} DESC";
$Recordset2 = mysqli_query($connect, $query_Recordset2) or die(mysqli_error($connect));
while($row_2 = mysqli_fetch_assoc($Recordset2)) {
echo "Contato: ".$row_2["name"]."</br>";
echo "CPF/CNPJ: ".$row_2["cpf_cnpj"]."</br>";
echo "e-mail: ".$row_2["email"]."</br>";
echo "Celular: ".$row_2["cellphone"]."</br>";
echo "Telefone: ".$row_2["telephone"]."</br>";
echo "Documento de identificação: ".$row_2["name"]."</br>";
echo "</br>";
}?>
</td>
<td bgcolor="#F5F5F5"><?php
$_SESSION['DB_base'] = 'tupa';
$_SESSION['table_base'] = 'projects_link_tpm';
$query_Recordset3 = "SELECT * FROM {$_SESSION['table_base']} where people_record_id = {$row_Recordset1['id']} order by {$_SESSION['id_base']} DESC";
$Recordset3 = mysqli_query($connect, $query_Recordset3) or die(mysqli_error($connect));
while($row_3 = mysqli_fetch_assoc($Recordset3)) {
echo "Projeto: ".$row_3["id"]."</br>";
echo "</br>";
}?>
</td>
<td width="3%" bgcolor="#F5F5F5"><form
action="mysql/update_process.php" method="POST">
<input type="hidden" name="update_process"
value="<?php echo $row_1[$_SESSION['id_base']] ?>"> <input
type="image" name="submit" src="imagens/edit.png" width="24"
height="24">
</form></td>
<td bgcolor="#F5F5F5"><form action="mysql/del_process.php"
method="POST">
<input type="hidden" name="delete_process"
value="<?php echo $row_1[$_SESSION['id_base']] ?>"> <input
type="hidden" name="delete_register"
value="<?php echo $row_1['name'] ?>"> <input
type="image" name="submit" src="imagens/delete.png" width="24"
height="24">
</form></td>
</tr>
<?php }?>
</table>
</fieldset>
<div id="rec_openModal" class="modalDialog">
<div>
<a class="close" title="Fechar" href="#close">X</a>
<fieldset>
<legend>Realizar cadastro</legend>
<br> <label>Modalidade:</label> <select name="modality"
onChange="mostraDiv(this.value)">
<option value="1">Cliente CPF</option>
<option value="2">Cliente CNPJ</option>
<option value="3">Contato de cliente</option>
<option value="4">Endereço de cliente</option>
</select> <br />
<div id="cpf">
<form action="mysql/insert_process.php" method="post" id='1'>
<br> <label>Nome: </label> <input name='name' type='text' /><br />
<br> <label>CPF: </label> <input name='cpf_cnpj' type='number'
placeholder="Ex.: 00000000000 (11 números)"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>e-mail: </label> <input name='email' type='email'
placeholder="Ex.: seunome@dominio.com.br" /><br /> <br> <label>Celular:
</label> <input name='cellphone' type='text'
placeholder="Ex.: 0XX9YYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Telefone: </label> <input name='telephone' type='text'
placeholder="Ex.: 0XXYYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Documento de identificação: </label> <input
type='file' name='doc_id'><br /> <INPUT TYPE="hidden"
NAME="record_caracter_id" VALUE="0"><INPUT TYPE="hidden"
NAME="action" VALUE="0"> <br> <label><input type="submit"
value="Cadastrar" /> </label><br />
</form>
</div>
<div id="cnpj">
<form action="mysql/insert_process.php" method="post" id='2'>
<br> <label>Nome da empresa: </label> <input name='name'
type='text' /><br /> <br> <label>CNPJ: </label> <input
name='cpf_cnpj' type='number'
placeholder="Ex.: 0000000000000 (14 números)"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>e-mail: </label> <input name='email' type='email'
placeholder="Ex.: seunome@dominio.com.br" /><br /> <br> <label>Celular:
</label> <input name='cellphone' type='text'
placeholder="Ex.: 0XX9YYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Telefone: </label> <input name='telephone' type='text'
placeholder="Ex.: 0XXYYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Documento de identificação: </label> <input
name='doc_id' type='file' /><br /> <INPUT TYPE="hidden"
NAME="record_caracter_id" VALUE="0"><INPUT TYPE="hidden"
NAME="action" VALUE="0"> <br> <label><input type="submit"
value="Cadastrar" /> </label><br />
</form>
</div>
<div id="contato">
<form action="mysql/insert_process.php" method="post" id='3'>
<br> <label>Nome: </label> <input name='name' type='text' /><br />
<br> <label>cpf: </label> <input name='cpf_cnpj' type='number'
placeholder="Ex.: 00000000000 (11 números)"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>e-mail: </label> <input name='email' type='email'
placeholder="Ex.: seunome@dominio.com.br" /><br /> <br> <label>Celular:
</label> <input name='cellphone' type='text'
placeholder="Ex.: 0XX9YYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Telefone: </label> <input name='telephone' type='text'
placeholder="Ex.: 0XXYYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Documento de identificação: </label> <input
type='file' name='doc_id'><br /> <INPUT TYPE="hidden"
NAME="record_caracter_id" VALUE="1"><br> <label>Contato do
cliente </label> <select name="link_record">
<?php
while ($data = mysqli_fetch_array($Recordset1)) {
echo("<option value='".$data['id']."'>".$data['name']."</option>");
}
?>
</select><br /> <INPUT TYPE="hidden" NAME="action" VALUE="0"> <br>
<label><input type="submit" value="Cadastrar" /> </label><br />
</form>
</div>
<div id="endereco">
<form action="mysql/insert_process.php" method="post" id='4'>
<br> <label>CEP: </label> <input name='cep' type='number'
placeholder="Ex.: 00000000 (8 números)"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br /> <br>
<label>Logradouro: </label> <input name='address' type='text' /><br />
<br> <label>Número: </label> <input name='number' type='text' /><br />
<br> <label>Bairro: </label> <input name='neighborhood'
type='text' /><br /> <br> <label>Cidade/UF: </label> <input
name='city' type='text' /><input name='uf' type='text' placeholder="Ex.: MG"
pattern="[A-Z][A-Z]"/><br /> <INPUT
TYPE="hidden" NAME="record_caracter_id" VALUE="4"><INPUT
TYPE="hidden" NAME="action" VALUE="1"> <br> <label><input
type="submit" value="Cadastrar" /> </label><br />
</form>
</div>
<div id="projeto">
<form action="mysql/insert_process.php" method="post">
<br> <label>Produto:</label> <select name="name" id="name">
<?php
$_SESSION['DB_base'] = 'qdpm';
$_SESSION['table_base'] = 'projects_types';
$Recordset4 = mysqli_query($connect, "SELECT * FROM {$_SESSION['table_base']} order by {$_SESSION['id_base']} DESC") or die(mysql_error());
while ($row_4 = mysqli_fetch_array($Recordset1)) {
echo("<option value='".$row_4['name']."'>".$row_4['name']."</option>");
}
?>
</select> <br /> <br> <label>Cliente:</label> <select
name="client" id="client">
<?php
while ($row_5 = mysqli_fetch_array($Recordset1)) {
echo("<option value='".$row_5['client']."'>".$row_5['client']."</option>");
}
?>
</select> <br /> <input type="hidden" name="projects_status_id"
value="1"> <input type="hidden" name="projects_type_id" value="2">
<input type="hidden" name="created_by" value="3"> <input
type="hidden" name="team" value="4,3,"> <label><input
type="submit" value="Cadastrar" /> </label>
</form>
</div>
</fieldset>
</div>
</div>
</body>
</html>
<?php
mysqli_free_result($Recordset1);
mysqli_free_result($Recordset2);
mysqli_free_result($Recordset3);
?>Como você sabe que está em loop infinito?
Porque sobrecarrega o servidor a ponto de travar e derrubar todos os sites quando a página é executada.
veja se a sua session de table_base traz algum valor...
além disso, ja que você esta pondo as variaveis dentro dos colchetes, inclui aspas simples
coluna = '{$variavel}'
mais ainda... se o table_base traz o nome da tabela corretamente, quantos registros existem nessa tabela?
as vezes o seu erro acontece pq você tem muitos registros para iterar e o servidor da crash/timeout assim como o navegador do usuario por ser muitos dados para imprimir...
afim de apenas teste implemente um limit 10 na sua query...
aplique a condicao mysqli_error apos a execucao da qiery para identificar possiveis erros
Bom dia Luiz!
Existem 5 registros.
Ao adicionar as aspas, começou a retornar o seguinte erro:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''people_records' ORDER BY 'id' DESC' at line 1
Os recordset estão retornando as pesquisas corretamente. Creio que o problema está nos while.
<?php
session_start();
$_SESSION['last_page'] = $_SERVER['PHP_SELF'];
$_SESSION['del_message'] = 'Deseja excluir o cliente ';
require_once('connections.php');
$_SESSION['DB_base'] = 'tupa';
$_SESSION['table_base'] = 'people_records';
$_SESSION['id_base'] = 'id';
$query_Recordset1 = "SELECT * FROM {$_SESSION['table_base']} ORDER BY {$_SESSION['id_base']} DESC";
$Recordset1 = mysqli_query($connect, $query_Recordset1) or die(mysqli_error($connect));
$row_Recordset1 = mysqli_fetch_assoc($Recordset1);
$_SESSION['table_base'] = 'projects_link_tpm';
$query_Recordset2 = "SELECT * FROM {$_SESSION['table_base']} ORDER BY {$_SESSION['id_base']} DESC";
$Recordset2 = mysqli_query($connect, $query_Recordset2) or die(mysqli_error($connect));
$row_Recordset2 = mysqli_fetch_assoc($Recordset2);
?>
<!doctype html>
<html lang='pt-br'>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tupã - Serviços de Engenharia</title>
<link href='css/sistema.css' rel='stylesheet' type='text/css'
media='all'>
<style type="text/css">
#cnpj {
display: none;
}
#contato {
display: none;
}
#endereco {
display: none;
}
#projeto {
display: none;
}
</style>
</head>
<body>
<fieldset>
<legend>Gerenciamento de Clientes</legend>
<table id="tabela">
<thead>
<tr>
<th>Descrição</th>
<th>Contato</th>
<th>Projetos</th>
<th colspan="3">Ação</th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th colspan="3"><input type="submit" value="Filtrar" /> | <input
type="button" onclick="javascript: location.href='#rec_openModal'"
value="Adicionar" /></th>
</tr>
</thead>
<?php while ($row_1 = $row_Recordset1){
if ($row_1['record_caracter_id'] = '0') {
$row_1 = $row_Recordset1;
?>
<tr>
<td bgcolor="#F5F5F5"><p>
<?php
echo "Cliente: ".$row_1["name"]."</br>";
echo "CPF/CNPJ: ".$row_1["cpf_cnpj"]."</br>";
echo "e-mail: ".$row_1["email"]."</br>";
echo "Celular: ".$row_1["cellphone"]."</br>";
echo "Telefone: ".$row_1["telephone"]."</br>";
if(file_exists('imagens/clients/energy_bill/'.$row_1['id'].'.jpg'))
{
echo 'Documento de identificação: <a href=imagens/clients/energy_bill/'.$row_1['id'].'.jpg target="_blank"><img src="imagens/view.png" width="24" height="24">';
}
else
{
echo 'Documento de identificação: indisponível';
}
?>
</p>
</td>
<td bgcolor="#F5F5F5"><?php
while($row_2 = $row_Recordset1) {
if ($row_2['link_record'] = $row_1['id'] AND $row_2['record_caracter_id'] = '1') {
echo "Contato: ".$row_2["name"]."</br>";
echo "CPF/CNPJ: ".$row_2["cpf_cnpj"]."</br>";
echo "e-mail: ".$row_2["email"]."</br>";
echo "Celular: ".$row_2["cellphone"]."</br>";
echo "Telefone: ".$row_2["telephone"]."</br>";
echo "Documento de identificação: ".$row_2["name"]."</br>";
echo "</br>";
}}?>
</td>
<td bgcolor="#F5F5F5"><?php
while($row_3 = $row_Recordset2) {
if ($row_3['people_record_id'] = $row_1['id']) {
echo "Projeto: ".$row_3["id"]."</br>";
echo "</br>";
}}?></td>
<td width="3%" bgcolor="#F5F5F5"><form
action="mysql/update_process.php" method="POST">
<input type="hidden" name="update_process"
value="<?php echo $row_1[$_SESSION['id_base']] ?>"> <input
type="image" name="submit" src="imagens/edit.png" width="24"
height="24">
</form></td>
<td bgcolor="#F5F5F5"><form action="mysql/del_process.php"
method="POST">
<input type="hidden" name="delete_process"
value="<?php echo $row_1[$_SESSION['id_base']] ?>"> <input
type="hidden" name="delete_register"
value="<?php echo $row_1['name'] ?>"> <input type="image"
name="submit" src="imagens/delete.png" width="24" height="24">
</form></td>
</tr>
<?php }}?>
</table>
</fieldset>
<div id="rec_openModal" class="modalDialog">
<div>
<a class="close" title="Fechar" href="#close">X</a>
<fieldset>
<legend>Realizar cadastro</legend>
<br> <label>Modalidade:</label> <select name="modality"
onChange="mostraDiv(this.value)">
<option value="1">Cliente CPF</option>
<option value="2">Cliente CNPJ</option>
<option value="3">Contato de cliente</option>
<option value="4">Endereço de cliente</option>
</select> <br />
<div id="cpf">
<form action="mysql/insert_process.php" method="post" id='1'>
<br> <label>Nome: </label> <input name='name' type='text' /><br />
<br> <label>CPF: </label> <input name='cpf_cnpj' type='number'
placeholder="Ex.: 00000000000 (11 números)"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>e-mail: </label> <input name='email' type='email'
placeholder="Ex.: seunome@dominio.com.br" /><br /> <br> <label>Celular:
</label> <input name='cellphone' type='text'
placeholder="Ex.: 0XX9YYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Telefone: </label> <input name='telephone' type='text'
placeholder="Ex.: 0XXYYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Documento de identificação: </label> <input
type='file' name='doc_id'><br /> <INPUT TYPE="hidden"
NAME="record_caracter_id" VALUE="0"><INPUT TYPE="hidden"
NAME="action" VALUE="0"> <br> <label><input type="submit"
value="Cadastrar" /> </label><br />
</form>
</div>
<div id="cnpj">
<form action="mysql/insert_process.php" method="post" id='2'>
<br> <label>Nome da empresa: </label> <input name='name'
type='text' /><br /> <br> <label>CNPJ: </label> <input
name='cpf_cnpj' type='number'
placeholder="Ex.: 0000000000000 (14 números)"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>e-mail: </label> <input name='email' type='email'
placeholder="Ex.: seunome@dominio.com.br" /><br /> <br> <label>Celular:
</label> <input name='cellphone' type='text'
placeholder="Ex.: 0XX9YYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Telefone: </label> <input name='telephone' type='text'
placeholder="Ex.: 0XXYYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Documento de identificação: </label> <input
name='doc_id' type='file' /><br /> <INPUT TYPE="hidden"
NAME="record_caracter_id" VALUE="0"><INPUT TYPE="hidden"
NAME="action" VALUE="0"> <br> <label><input type="submit"
value="Cadastrar" /> </label><br />
</form>
</div>
<div id="contato">
<form action="mysql/insert_process.php" method="post" id='3'>
<br> <label>Nome: </label> <input name='name' type='text' /><br />
<br> <label>cpf: </label> <input name='cpf_cnpj' type='number'
placeholder="Ex.: 00000000000 (11 números)"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>e-mail: </label> <input name='email' type='email'
placeholder="Ex.: seunome@dominio.com.br" /><br /> <br> <label>Celular:
</label> <input name='cellphone' type='text'
placeholder="Ex.: 0XX9YYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Telefone: </label> <input name='telephone' type='text'
placeholder="Ex.: 0XXYYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Documento de identificação: </label> <input
type='file' name='doc_id'><br /> <INPUT TYPE="hidden"
NAME="record_caracter_id" VALUE="1"><br> <label>Contato do
cliente </label> <select name="link_record">
<?php
while ($row_4 = mysqli_fetch_array($Recordset1)) {
echo("<option value='".$row_4['id']."'>".$row_4['name']."</option>");
}
?>
</select><br /> <INPUT TYPE="hidden" NAME="action" VALUE="0"> <br>
<label><input type="submit" value="Cadastrar" /> </label><br />
</form>
</div>
<div id="endereco">
<form action="mysql/insert_process.php" method="post" id='4'>
<br> <label>CEP: </label> <input name='cep' type='number'
placeholder="Ex.: 00000000 (8 números)"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br /> <br>
<label>Logradouro: </label> <input name='address' type='text' /><br />
<br> <label>Número: </label> <input name='number' type='text' /><br />
<br> <label>Bairro: </label> <input name='neighborhood'
type='text' /><br /> <br> <label>Cidade/UF: </label> <input
name='city' type='text' /><input name='uf' type='text'
placeholder="Ex.: MG" pattern="[A-Z][A-Z]" /><br /> <INPUT
TYPE="hidden" NAME="record_caracter_id" VALUE="4"><INPUT
TYPE="hidden" NAME="action" VALUE="1"> <br> <label><input
type="submit" value="Cadastrar" /> </label><br />
</form>
</div>
<div id="projeto">
<form action="mysql/insert_process.php" method="post">
<br> <label>Produto:</label> <select name="name" id="name">
<?php
$_SESSION['DB_base'] = 'qdpm';
$_SESSION['table_base'] = 'projects_types';
$Recordset5 = mysqli_query($connect, "SELECT * FROM {$_SESSION['table_base']} order by {$_SESSION['id_base']} DESC") or die(mysql_error());
while ($row_5 = mysqli_fetch_array($Recordset1)) {
echo("<option value='".$row_5['name']."'>".$row_5['name']."</option>");
}
?>
</select> <br /> <br> <label>Cliente:</label> <select
name="client" id="client">
<?php
while ($row_5 = mysqli_fetch_array($Recordset1)) {
echo("<option value='".$row_5['client']."'>".$row_5['client']."</option>");
}
?>
</select> <br /> <input type="hidden" name="projects_status_id"
value="1"> <input type="hidden" name="projects_type_id" value="2">
<input type="hidden" name="created_by" value="3"> <input
type="hidden" name="team" value="4,3,"> <label><input
type="submit" value="Cadastrar" /> </label>
</form>
</div>
</fieldset>
</div>
</div>
</body>
</html>
<?php
mysqli_free_result($Recordset1);
mysqli_free_result($Recordset2);
mysqli_free_result($Recordset3);
?>Depois de muito mexer, está dando erro fatal na linha 64 (linha do if)
<?php while ($row_1 = $row_Recordset1) {
if ($row_1['record_caracter_id'] == '0') {
?>
<tr>Tente por favor:
<?php
session_start();
$_SESSION['last_page'] = $_SERVER['PHP_SELF'];
$_SESSION['del_message'] = 'Deseja excluir o cliente ';
$_SESSION['DB_base'] = 'tupa';
$_SESSION['table_base'] = 'people_records';
$_SESSION['id_base'] = 'id';
require_once('connections.php');
$query_Recordset1 = "SELECT * FROM {$_SESSION['table_base']} WHERE record_caracter_id = '0' order by {$_SESSION['id_base']} DESC";
$Recordset1 = mysqli_query($connect, $query_Recordset1) or die(mysql_error());
$row_Recordset1 = mysqli_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysqli_num_rows($Recordset1);
?>
<!doctype html>
<html lang='pt-br'>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tupã - Serviços de Engenharia</title>
<link href='css/sistema.css' rel='stylesheet' type='text/css'
media='all'>
<style type="text/css">
#cnpj {
display: none;
}
#contato {
display: none;
}
#endereco {
display: none;
}
</style>
</head>
<body>
<fieldset>
<legend>Gerenciamento de Clientes</legend>
<table id="tabela">
<thead>
<tr>
<th>Descrição</th>
<th>Contato</th>
<th>Projetos</th>
<th colspan="3">Ação</th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th colspan="3"><input type="submit" value="Filtrar" /> | <input
type="button" onclick="javascript: location.href='#rec_openModal'"
value="Adicionar" /></th>
</tr>
</thead>
<?php while ($new_cordset1 = mysqli_fetch_assoc($Recordset1)){?>
<tr>
<td bgcolor="#F5F5F5"><p>
Código:
<?php echo $new_cordset1['id']; ?>
<br /> Cliente:
<?php echo $new_cordset1['name']; ?>
<br /> CPF/CNPJ:
<?php echo $new_cordset1['cpf_cnpj']; ?>
<br /> e-mail:
<?php echo $new_cordset1['email']; ?>
<br /> Celular:
<?php echo $new_cordset1['cellphone']; ?>
<br /> Telefone:
<?php echo $new_cordset1['telephone']; ?>
<br /> Documento de identificação:
<?php
if(file_exists('imagens/clients/energy_bill/'.$new_cordset1['id'].'.jpg'))
{
echo 'Documento de identificação: <a href=imagens/clients/energy_bill/'.$new_cordset1['id'].'.jpg target="_blank"><img src="imagens/view.png" width="24" height="24">';
}
else
{
echo 'Documento de identificação: indisponível';
}
?>
</p></td>
<td bgcolor="#F5F5F5"><?php
$_SESSION['DB_base'] = 'tupa';
$_SESSION['table_base'] = 'people_records';
$query_Recordset2 = "SELECT * FROM {$_SESSION['table_base']} WHERE `link_record` = {$data1['id']} AND `record_caracter_id` = 1 order by {$_SESSION['id_base']} DESC";
$Recordset2 = mysqli_query($connect, $query_Recordset2) or die(mysqli_error($connect));
$row_Recordset2 = mysqli_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysqli_num_rows($Recordset2);
while($new_cordset2 = mysqli_fetch_assoc($Recordset2)) {
echo "Contato: ".$new_cordset2["name"]."</br>";
echo "CPF/CNPJ: ".$new_cordset2["cpf_cnpj"]."</br>";
echo "e-mail: ".$new_cordset2["email"]."</br>";
echo "Celular: ".$new_cordset2["cellphone"]."</br>";
echo "Telefone: ".$new_cordset2["telephone"]."</br>";
echo "Documento de identificação: ".$new_cordset2["name"]."</br>";
echo "</br>";
}?>
</td>
<td bgcolor="#F5F5F5"><?php
$_SESSION['DB_base'] = 'tupa';
$_SESSION['table_base'] = 'projects_link_tpm';
$query_Recordset3 = "SELECT * FROM {$_SESSION['table_base']} where people_record_id = {$row_Recordset1['id']} order by {$_SESSION['id_base']} DESC";
$Recordset3 = mysqli_query($connect, $query_Recordset3) or die(mysqli_error($connect));
$row_Recordset3 = mysqli_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysqli_num_rows($Recordset3);
while($new_cordset3 = mysqli_fetch_assoc($Recordset3)) {
echo "Projeto: ".$new_cordset3["id"]."</br>";
echo "</br>";
}?>
</td>
<td width="3%" bgcolor="#F5F5F5"><form
action="mysql/update_process.php" method="POST">
<input type="hidden" name="update_process"
value="<?php echo $row_Recordset1[$_SESSION['id_base']] ?>"> <input
type="image" name="submit" src="imagens/edit.png" width="24"
height="24">
</form></td>
<td bgcolor="#F5F5F5"><form action="mysql/del_process.php"
method="POST">
<input type="hidden" name="delete_process"
value="<?php echo $row_Recordset1[$_SESSION['id_base']] ?>"> <input
type="hidden" name="delete_register"
value="<?php echo $row_Recordset1['name'] ?>"> <input
type="image" name="submit" src="imagens/delete.png" width="24"
height="24">
</form></td>
</tr>
<?php }?>
</table>
</fieldset>
<div id="rec_openModal" class="modalDialog">
<div>
<a class="close" title="Fechar" href="#close">X</a>
<fieldset>
<legend>Realizar cadastro</legend>
<br> <label>Modalidade:</label> <select name="modality"
onChange="mostraDiv(this.value)">
<option value="1">Cliente CPF</option>
<option value="2">Cliente CNPJ</option>
<option value="3">Contato de cliente</option>
<option value="4">Endereço de cliente</option>
</select> <br />
<div id="cpf">
<form action="mysql/insert_process.php" method="post" id='1'>
<br> <label>Nome: </label> <input name='name' type='text' /><br />
<br> <label>CPF: </label> <input name='cpf_cnpj' type='number'
data-mask='000.000.000-00' /><br /> <br> <label>e-mail: </label>
<input name='email' type='text' /><br /> <br> <label>Celular: </label>
<input name='cellphone' type='text' data-mask="(00)0000-0000" /><br />
<br> <label>Telefone: </label> <input name='telephone' type='text'
data-mask='(00)00000-0000' autocomplete='off' /><br /> <br> <label>Documento
de identificação: </label> <input type='file' name='doc_id'><br />
<INPUT TYPE="hidden" NAME="record_caracter_id" VALUE="0"><INPUT
TYPE="hidden" NAME="action" VALUE="0"> <br> <label><input
type="submit" value="Cadastrar" /> </label><br />
</form>
</div>
<div id="cnpj">
<form action="mysql/insert_process.php" method="post" id='2'>
<br> <label>Nome da empresa: </label> <input name='name'
type='text' /><br /> <br> <label>CNPJ: </label> <input
name='cpf_cnpj' type='text' data-mask="00.000.000/0000-00" /><br />
<br> <label>e-mail: </label> <input name='email' type='email' /><br />
<br> <label>Celular: </label> <input name='cellphone' type='text'
data-mask="00000-000" /><br /> <br> <label>Telefone: </label> <input
name='telephone' type='text' /><br /> <br> <label>Documento de
identificação: </label> <input name='doc_id' type='file' /><br />
<INPUT TYPE="hidden" NAME="record_caracter_id" VALUE="0"><INPUT
TYPE="hidden" NAME="action" VALUE="0"> <br> <label><input
type="submit" value="Cadastrar" /> </label><br />
</form>
</div>
<div id="contato">
<form action="mysql/insert_process.php" method="post" id='3'>
<br> <label>Nome: </label> <input name='name' type='text' /><br />
<br> <label>cpf: </label> <input name='cpf' type='number'
data-mask='000.000.000-00' /><br /> <br> <label>e-mail: </label>
<input name='email' type='text' /><br /> <br> <label>Celular: </label>
<input name='cellphone' type='text' data-mask="(00)0000-0000" /><br />
<br> <label>Telefone: </label> <input name='telephone' type='text'
data-mask='(00)00000-0000' autocomplete='off' /><br /> <br> <label>Documento
de identificação: </label> <input type='file' name='doc_id'><br />
<INPUT TYPE="hidden" NAME="record_caracter_id" VALUE="1"><br> <label>Contato
do cliente </label> <select name="link_record">
<?php
while ($new_cordset4 = mysqli_fetch_array($Recordset1)) {
echo("<option value='".$new_cordset4['id']."'>".$new_cordset4['name']."</option>");
}
?>
</select><br /> <INPUT TYPE="hidden" NAME="action" VALUE="0"> <br>
<label><input type="submit" value="Cadastrar" /> </label><br />
</form>
</div>
<div id="endereco">
<form action="mysql/insert_process.php" method="post" id='4'>
<br> <label>CEP: </label> <input name='cep' type='text' /><br /> <br>
<label>Logradouro: </label> <input name='address' type='text'
data-mask="00000-000" autocomplete="off" /><br /> <br> <label>Número:
</label> <input name='number' type='text' /><br /> <br> <label>Bairro:
</label> <input name='neighborhood' type='text' /><br /> <br> <label>Cidade/UF:
</label> <input name='city' type='text' /><input name='uf'
type='text' /><br /> <INPUT TYPE="hidden"
NAME="record_caracter_id" VALUE="4"><INPUT TYPE="hidden"
NAME="action" VALUE="1"> <br> <label><input type="submit"
value="Cadastrar" /> </label><br />
</form>
</div>
</fieldset>
</div>
</div>
</body>
</html>
<?php
mysqli_free_result($Recordset1);
mysqli_free_result($Recordset2);
mysqli_free_result($Recordset3);
?>
Espero ter Ajudado :)Ajudou! Mas o correto é ter uma pesquisa separado para cada while também. Resolvido!
Vou postar o código final.
<?php
session_start();
$_SESSION['last_page'] = $_SERVER['PHP_SELF'];
$_SESSION['del_message'] = 'Deseja excluir o cliente ';
require_once('phpfunctions.php');
$Recordset1 = mysqli_query(connect(tupa), "SELECT * FROM people_records WHERE record_caracter_id = 0 ORDER BY id DESC") or die(mysqli_error(connect(tupa)));
?>
<!doctype html>
<html lang='pt-br'>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tupã - Serviços de Engenharia</title>
<link href='css/sistema.css' rel='stylesheet' type='text/css'
media='all'>
<style type="text/css">
#cnpj {
display: none;
}
#contato {
display: none;
}
#endereco {
display: none;
}
#projeto {
display: none;
}
</style>
</head>
<body>
<fieldset>
<legend>Gerenciamento de Clientes</legend>
<table id="tabela">
<thead>
<tr>
<th>Descrição</th>
<th>Contato</th>
<th>Projetos</th>
<th colspan="3">Ação</th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th colspan="3"><input type="submit" value="Filtrar" /> | <input
type="button" onclick="javascript: location.href='#rec_openModal'"
value="Adicionar" /></th>
</tr>
</thead>
<?php while ($row_1 = mysqli_fetch_assoc($Recordset1)) {
?>
<tr>
<td bgcolor="#F5F5F5"><p>
<?php
echo "Cliente: ".$row_1["name"]."</br>";
echo "CPF/CNPJ: ".$row_1["cpf_cnpj"]."</br>";
echo "e-mail: ".$row_1["email"]."</br>";
echo "Celular: ".$row_1["cellphone"]."</br>";
echo "Telefone: ".$row_1["telephone"]."</br>";
if(file_exists('imagens/clients/energy_bill/'.$row_1['id'].'.jpg'))
{
echo 'Documento de identificação: <a href=imagens/clients/energy_bill/'.$row_1['id'].'.jpg target="_blank"><img src="imagens/view.png" width="24" height="24">';
}
else
{
echo 'Documento de identificação: indisponível';
}
?>
</p>
</td>
<td bgcolor="#F5F5F5"><?php
$Recordset2 = mysqli_query(connect(tupa), "SELECT * FROM people_records WHERE record_caracter_id = 1 AND link_record = {$row_1['id']} ORDER BY id DESC") or die(mysqli_error(connect(tupa)));
while($row_2 = mysqli_fetch_assoc($Recordset2)) {
if ($row_2['link_record'] = $row_1['id'] AND $row_2['record_caracter_id'] = '1') {
echo "Contato: ".$row_2["name"]."</br>";
echo "CPF/CNPJ: ".$row_2["cpf_cnpj"]."</br>";
echo "e-mail: ".$row_2["email"]."</br>";
echo "Celular: ".$row_2["cellphone"]."</br>";
echo "Telefone: ".$row_2["telephone"]."</br>";
echo "Documento de identificação: ".$row_2["name"]."</br>";
echo "</br>";
}}?>
</td>
<td bgcolor="#F5F5F5"><?php
$query_Recordset3 = "SELECT * FROM projects_link_tpm WHERE people_record_id = {$row_1['id']} ORDER BY id DESC";
$Recordset3 = mysqli_query(connect(tupa), $query_Recordset3) or die(mysqli_error(connect(tupa)));
$row_Recordset3 = mysqli_fetch_assoc($Recordset3);
while($row_3 = mysqli_fetch_assoc($Recordset3)) {
echo "Projeto: ".$row_3["id"]."</br>";
echo "</br>";
}?>
</td>
<td width="3%" bgcolor="#F5F5F5"><form
action="mysql/update_process.php" method="POST">
<input type="hidden" name="update_process"
value="<?php echo $row_1['id'] ?>"> <input type="image"
name="submit" src="imagens/edit.png" width="24" height="24">
</form></td>
<td bgcolor="#F5F5F5"><form action="mysql/del_process.php"
method="POST">
<input type="hidden" name="delete_process"
value="<?php echo $row_1['id'] ?>"> <input type="hidden"
name="delete_register" value="<?php echo $row_1['name'] ?>"> <input
type="image" name="submit" src="imagens/delete.png" width="24"
height="24">
</form></td>
</tr>
<?php }?>
</table>
</fieldset>
<div id="rec_openModal" class="modalDialog">
<div>
<a class="close" title="Fechar" href="#close">X</a>
<fieldset>
<legend>Realizar cadastro</legend>
<br> <label>Cadastrar </label> <select name="modality"
onChange="mostraDiv(this.value)">
<option value="1">novo cliente CPF</option>
<option value="2">novo cliente CNPJ</option>
<option value="3">novo contato de cliente</option>
<option value="4">novo endereço de cliente ou contato</option>
<option value="5">novo projeto</option>
</select> <br />
<div id="cpf">
<form action="mysql/insert_process.php" method="post" id='1'>
<br> <label>Nome: </label> <input name='name' type='text' /><br />
<br> <label>CPF: </label> <input name='cpf_cnpj' type='number'
placeholder="Ex.: 00000000000 (11 números)"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>e-mail: </label> <input name='email' type='email'
placeholder="Ex.: seunome@dominio.com.br" /><br /> <br> <label>Celular:
</label> <input name='cellphone' type='text'
placeholder="Ex.: 0XX9YYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Telefone: </label> <input name='telephone' type='text'
placeholder="Ex.: 0XXYYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Documento de identificação: </label> <input
type='file' name='doc_id'><br /> <INPUT TYPE="hidden"
NAME="record_caracter_id" VALUE="0"><INPUT TYPE="hidden"
NAME="action" VALUE="0"> <br> <label><input type="submit"
value="Cadastrar" /> </label><br />
</form>
</div>
<div id="cnpj">
<form action="mysql/insert_process.php" method="post" id='2'>
<br> <label>Nome da empresa: </label> <input name='name'
type='text' /><br /> <br> <label>CNPJ: </label> <input
name='cpf_cnpj' type='number'
placeholder="Ex.: 0000000000000 (14 números)"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>e-mail: </label> <input name='email' type='email'
placeholder="Ex.: seunome@dominio.com.br" /><br /> <br> <label>Celular:
</label> <input name='cellphone' type='text'
placeholder="Ex.: 0XX9YYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Telefone: </label> <input name='telephone' type='text'
placeholder="Ex.: 0XXYYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Documento de identificação: </label> <input
name='doc_id' type='file' /><br /> <INPUT TYPE="hidden"
NAME="record_caracter_id" VALUE="0"><INPUT TYPE="hidden"
NAME="action" VALUE="0"> <br> <label><input type="submit"
value="Cadastrar" /> </label><br />
</form>
</div>
<div id="contato">
<form action="mysql/insert_process.php" method="post" id='3'>
<br> <label>Nome: </label> <input name='name' type='text' /><br />
<br> <label>cpf: </label> <input name='cpf_cnpj' type='number'
placeholder="Ex.: 00000000000 (11 números)"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>e-mail: </label> <input name='email' type='email'
placeholder="Ex.: seunome@dominio.com.br" /><br /> <br> <label>Celular:
</label> <input name='cellphone' type='text'
placeholder="Ex.: 0XX9YYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Telefone: </label> <input name='telephone' type='text'
placeholder="Ex.: 0XXYYYYYYYY"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br />
<br> <label>Documento de identificação: </label> <input
type='file' name='doc_id'><br /> <INPUT TYPE="hidden"
NAME="record_caracter_id" VALUE="1"><br> <label>Contato do
cliente </label> <select name="link_record">
<?php
while ($row_4 = mysqli_fetch_array($Recordset1)) {
echo("<option value='".$row_4['id']."'>".$row_4['name']."</option>");
}
?>
</select><br /> <INPUT TYPE="hidden" NAME="action" VALUE="0"> <br>
<label><input type="submit" value="Cadastrar" /> </label><br />
</form>
</div>
<div id="endereco">
<form action="mysql/insert_process.php" method="post" id='4'>
<br> <label>CEP: </label> <input name='cep' type='number'
placeholder="Ex.: 00000000 (8 números)"
pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" /><br /> <br>
<label>Logradouro: </label> <input name='address' type='text' /><br />
<br> <label>Número: </label> <input name='number' type='text' /><br />
<br> <label>Bairro: </label> <input name='neighborhood'
type='text' /><br /> <br> <label>Cidade/UF: </label> <input
name='city' type='text' /><input name='uf' type='text'
placeholder="Ex.: MG" pattern="[A-Z][A-Z]" /><br /> <INPUT
TYPE="hidden" NAME="record_caracter_id" VALUE="4"><INPUT
TYPE="hidden" NAME="action" VALUE="1"> <br> <label><input
type="submit" value="Cadastrar" /> </label><br />
</form>
</div>
<div id="projeto">
<form action="mysql/insert_process.php" method="post">
<br> <label>Produto:</label> <select name="name" id="name">
<?php
$Recordset5 = mysqli_query(connect(qdpm), "SELECT * FROM projects_types ORDER BY id ASC") or die(mysql_error());
while ($row_5 = mysqli_fetch_array($Recordset5)) {
echo("<option value='".$row_5['name']."'>".$row_5['name']."</option>");
}
?>
</select> <br /> <br> <label>Cliente:</label> <select
name="client" id="client">
<?php
$Recordset6 = mysqli_query(connect(tupa), "SELECT * FROM people_records WHERE record_caracter_id = 0 ORDER BY id DESC") or die(mysql_error());
while ($row_6 = mysqli_fetch_array($Recordset6)) {
echo("<option value='".$row_6['id']."'>".$row_6['name']."</option>");
}
?>
</select> <br /> <input type="hidden" name="projects_status_id"
value="1"> <input type="hidden" name="projects_type_id" value="2">
<input type="hidden" name="created_by" value="3"> <input
type="hidden" name="team" value="4,3,"> <br> <label><input
type="submit" value="Cadastrar" /> </label><br />
</form>
</div>
</fieldset>
</div>
</div>
</body>
</html>
<?php
mysqli_free_result($Recordset1);
mysqli_free_result($Recordset2);
mysqli_free_result($Recordset3);
?>
Acredito que o erro seja na linha abaixo:
while($Recordset2 = mysqli_fetch_assoc($Recordset2)) {
Está usando a mesma variável para receber e passar o fetch_assoc, criar um $row para receber o fetch para testar.