php - Trying to query an array -


I have a table in which the function has an ID that is in reference to another table named after the function (FinCao in Portuguese , As presented in the code). I want to print the name of all the functions next to that person's name in that function.

Basically the code of the whole program is for the user to write something in a search bar and it is shown, because the user presses a key, the results are shown. Here is the part that is giving me errors (the search_string variable is the field where the user writes.)

  $ query = 'SELECT * from the users where "%'. $ Search_string '%' '; $ Result = $ tutorial- db- & gt; query ($ query); while ($ result = $ result-> fetch_re ()) {$ result_array [] = $ result;}   

The above questions take the name of the user.

  $ query2 = 'Select * Funnel from WHERE id_funcao = "'. $ Result_array ["id_funcao"]. ''; $ Result2 = $ tutorial- db- & gt; query ($ query2); while ($ results2 = $ result2- & gt; fetch_re ()) {$ result_array2 [] = $ results2;}   

This one takes the ID of the function of that user, and tries to be asked to get the name of the function.

Thanks in advance

By joining the easiest way of doing this

  select utilizadores.nome, Funcoes.funcao Are using funcoes (utilizadores.id_funcao = funcoes.id_funcao) where utilizadores.nome "% & lt;        



Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -