Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

phfmiranda

Resultado de várias tabelas em uma lista

Recommended Posts

Bom dia garela,

 

Tenho duas tabelas em um BD, uma de clientes e outra de convênios.

 

Quando cadastro um cliente ele grava no BD o código do convênio, porem quando peço para listar os meus clientes no lugar do nome do convenio está aparecendo o código, como faço para que no lugar do código apareça o nome do convenio que esta na tabela convenios?

 

<?php require_once('../Connections/Conecta_GW.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_Conecta_GW, $Conecta_GW);
$query_Lista_Clientes = "SELECT codigo_cliente, nome, convenio, telefone, celular, bloqueado FROM cliente ORDER BY nome ASC";
$Lista_Clientes = mysql_query($query_Lista_Clientes, $Conecta_GW) or die(mysql_error());
$row_Lista_Clientes = mysql_fetch_assoc($Lista_Clientes);
$totalRows_Lista_Clientes = mysql_num_rows($Lista_Clientes);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Lista Clientes</title>
</head>

<body>
<table width="100%" border="0">
  <tr>
    <td><strong>Código</strong></td>
    <td><strong>Nome</strong></td>
    <td><strong>Convênio</strong></td>
    <td><strong>Telefone</strong></td>
    <td><strong>Celular</strong></td>
    <td><strong>Status</strong></td>
  </tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_Lista_Clientes['codigo_cliente']; ?></td>
      <td><?php echo $row_Lista_Clientes['nome']; ?></td>
      <td><?php echo $row_Lista_Clientes['convenio']; ?></td>
      <td><?php echo $row_Lista_Clientes['telefone']; ?></td>
      <td><?php echo $row_Lista_Clientes['celular']; ?></td>
      <td><?php echo $row_Lista_Clientes['bloqueado']; ?></td>
    </tr>
    <?php } while ($row_Lista_Clientes = mysql_fetch_assoc($Lista_Clientes)); ?>
</table>
<p><!-- Função Imprimir //-->
<a href="javascript:;" onclick="window.print();return false"><img src="../Imagens/print.png" title="Imprimir" /></a></p></p>
</body>
</html>
<?php
mysql_free_result($Lista_Clientes);
?>

Tabelas MySql

3qpb.png

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.