Php Search Filter Mysql

Asked

Viewed 105 times

0

I have a database MySQL with various tables. Name of them below:

  • Table: formacao
  • Table: idiomas
  • Table: usuarios

I need to filter information, example:

The person wants the candidate who is a bricklayer, who knows English, who is in high school.

  • The information of profession, it is in the table usuarios.
  • Language information is in the table idiomas.
  • Schooling information is in the table formacao

Here’s my question. How to do a search that takes several tables?

Obs. In the table usuarios has id and in the others has idusuarios, the information that appears in the id appears in the idusuarios.

Table structure formacao:

CREATE TABLE `formacao` (
`idusuarios` int(255) NOT NULL,
`idformacao` int(255) NOT NULL,
`graudeformacao` varchar(255) NOT NULL,
`cursotecnico` varchar(255) NOT NULL,
`cursofaculdade` varchar(255) NOT NULL,
`situacao` varchar(255) NOT NULL,
`dataconclusao` varchar(50) NOT NULL,
`dia` varchar(50) NOT NULL,
`mes` varchar(50) NOT NULL,
`ano` varchar(50) NOT NULL,
`nomeinstituicao` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Table structure idiomas:

CREATE TABLE `idiomas` (
`idusuarios` int(255) NOT NULL,
`ididioma` int(255) NOT NULL,
`nomeidioma` varchar(100) NOT NULL,
`nivelidioma` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Table structure usuarios:

CREATE TABLE `usuarios` (
`id` int(255) NOT NULL,
`numerocir` varchar(30) NOT NULL,
`validadecir` varchar(20) NOT NULL,
`numpassaporte` varchar(100) NOT NULL,
`passvencimento` varchar(50) NOT NULL,
`categoria` varchar(20) NOT NULL,
`nomecompleto` text NOT NULL,
`email` varchar(255) NOT NULL,
`cpf` varchar(20) NOT NULL,
`senha` varchar(50) NOT NULL,
`datanascimento` varchar(30) NOT NULL,
`estadocivil` varchar(30) NOT NULL,
`sexo` varchar(20) NOT NULL,
`altura` varchar(20) NOT NULL,
`peso` varchar(20) NOT NULL,
`numerodabota` varchar(20) NOT NULL DEFAULT '0',
`nacionalidade` text NOT NULL,
`naturalidadeestado` text NOT NULL,
`naturalidadecidade` text NOT NULL,
`url` text NOT NULL,
`lembretedesenha` varchar(255) NOT NULL,
`fotorosto` varchar(255) NOT NULL,
`endcep` varchar(255) NOT NULL,
`endrua` varchar(255) NOT NULL,
`endnumero` varchar(200) NOT NULL,
`endcomplemento` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
`endbairro` text NOT NULL,
`endestado` text NOT NULL,
`endcidade` text NOT NULL,
`celular` varchar(255) NOT NULL,
`convencional` varchar(255) NOT NULL,
`convrecado` varchar(255) NOT NULL,
`convnomerecado` text NOT NULL,
`celrecado` varchar(255) NOT NULL,
`celnomerecado` text NOT NULL,
`numerodefilhos` varchar(20) NOT NULL DEFAULT '0',
`fumante` varchar(20) NOT NULL DEFAULT '0',
`idformacao` int(255) NOT NULL,
`idcursos` int(255) NOT NULL,
`idembarque` int(255) NOT NULL,
`idexperiencias` int(255) NOT NULL,
`ididiomas` int(255) NOT NULL,
`codigoadm` varchar(5) NOT NULL DEFAULT '0',
`moderacao` int(2) NOT NULL DEFAULT '0',
`codigoconfirma` varchar(255) NOT NULL,
`confirmarcaoemail` int(5) NOT NULL DEFAULT '0',
`reenvioemail` varchar(50) NOT NULL DEFAULT '0',
 `liberado` int(5) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  • Place the complete structure of the tables, will help formulate a more precise answer

  • We need to see the structure of the tables and the relationships between them. Anyway take a look at google on Inner Join.

  • Using JOIN you can get information from multiple tables. Date a look at this article with examples in PHP.<br /> http://blog.thiagobelem.net/relations-tabelas-no-mysql

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.