0
I’m not able to select more than one table to display only the ID and name data (table t_cadclients), I’m performing the SELECT of the entire t_cadcontracts table with WHERE in the contract number passed via SELECT from another page: common fields of the tables = "Sheet";
include"../Connections/config.php";
    $conexao = mysql_connect("$hostname_config","$username_config","$password_config")
                or die ("Erro ao realizar a conexão com o banco de dados, por favor informe o administrador do sistema ([email protected]) ou envie um email para [email protected] !");
    $db = mysql_select_db("$database_config")
                or die ("Erro ao selecionar o banco de dados, por favor informe o administrador do sistema ([email protected]) ou envie um email para [email protected] !");
    $contrato = $_GET['id'];
    $seleciona = mysql_query("SELECT * FROM t_cadcontratos WHERE NumContrato = '$contrato'");
    if($seleciona == '') {
        echo "Erro ao Selecionar, tente novamente !";
    } else {  
        while($res_id = mysql_fetch_array($seleciona)){
        $pdf->Cell(15,0.5,"N Contrato:",0,0,'R'); $pdf->Cell(2,0.5,$res_id['NumContrato'],1,1,'C');
....
Structure table t_cadclients
CREATE TABLE IF NOT EXISTS `t_cadclientes` (
  `Ficha` int(11) NOT NULL AUTO_INCREMENT,
  `Snome` varchar(50) DEFAULT NULL,
  `Endereco` varchar(50) DEFAULT NULL,
  `DataNascimento` datetime DEFAULT NULL,
  `Bairro` varchar(50) DEFAULT NULL,
  `Cidade` varchar(50) DEFAULT NULL,
  `Uf` varchar(50) DEFAULT NULL,
  `Fone` varchar(50) DEFAULT NULL,
  `Cpf` varchar(50) DEFAULT NULL,
  `Cgc` varchar(50) DEFAULT NULL,
  `Identidade` varchar(50) DEFAULT NULL,
  `Carteira Trabalho` varchar(50) DEFAULT NULL,
  `Pai` varchar(50) DEFAULT NULL,
  `Mae` varchar(50) DEFAULT NULL,
  `EstadoCivil` varchar(50) DEFAULT NULL,
  `Cep` varchar(50) DEFAULT NULL,
  `NomeEmpresa` varchar(50) DEFAULT NULL,
  `EndEmpresa` varchar(50) DEFAULT NULL,
  `BairroEmpresa` varchar(50) DEFAULT NULL,
  `CidadeEmpresa` varchar(50) DEFAULT NULL,
  `FoneEmpresa` varchar(50) DEFAULT NULL,
  `Ramal` varchar(50) DEFAULT NULL,
  `Renda` varchar(12) DEFAULT NULL,
  `NomeConjuge` varchar(50) DEFAULT NULL,
  `EmpresaConjuge` varchar(50) DEFAULT NULL,
  `EndEmpresaConjuge` varchar(50) DEFAULT NULL,
  `BairroEmpresaConjuge` varchar(50) DEFAULT NULL,
  `CidadeEmpresaConjuge` varchar(50) DEFAULT NULL,
  `FoneEmpresaConjuge` varchar(50) DEFAULT NULL,
  `RamalEmpresaConjuge` varchar(50) DEFAULT NULL,
  `RendaConjuge` varchar(12) DEFAULT NULL,
  `NomeContato` varchar(50) DEFAULT NULL,
  `EndContato` varchar(50) DEFAULT NULL,
  `FoneContato` varchar(50) DEFAULT NULL,
  `Relacao` varchar(50) DEFAULT NULL,
  `Loja1` varchar(50) DEFAULT NULL,
  `Loja2` varchar(50) DEFAULT NULL,
  `AtualizacaoCadastr` datetime DEFAULT NULL,
  `FichaDesde` datetime DEFAULT NULL,
  PRIMARY KEY (`Ficha`),
  KEY `Identidade` (`Identidade`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=23464 ;
structure table t_cadcontracts
CREATE TABLE IF NOT EXISTS `t_cadcontratos` (
  `Ficha` int(11) DEFAULT '0',
  `NumContrato` int(11) NOT NULL AUTO_INCREMENT,
  `DataContrato` datetime DEFAULT NULL,
  `QuantParcelas` tinyint(4) DEFAULT '3',
  `ValorContrato` decimal(19,4) DEFAULT '0.0000',
  `Entrada` decimal(19,4) DEFAULT '0.0000',
  `Saldo` decimal(19,4) DEFAULT '0.0000',
  `DescricaoProduto` varchar(50) DEFAULT NULL,
  `QuantProdutos` int(11) DEFAULT '0',
  `Vendedor` varchar(50) DEFAULT NULL,
  `FormaPagamento` varchar(50) DEFAULT 'CREDIÁRIO',
  PRIMARY KEY (`NumContrato`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2160 ;
						
Could you post the basic structure of the tables? What you really want is how to bring in the same select data from both tables using JOIN?
– Caputo
@Caputo just posted the structure, waiting!!
– Rafael Assmann