Execute query sql

0
$sql = "exec atualizar_feira '".$nome."', '".$endereco."', '".$cep."', '".$escolaridade."', '".$instituicao."', '".$telefone."', '".$email."', '".$aluno_cairu."', '".$curso."', '".$curso2."', '".$palestra."', '".$data."' ";

$result = mssql_query($sql); 

How do I run this $ sql?

    
asked by anonymous 31.01.2017 / 22:30

2 answers

2

As it is in the question, it already executes, to obtain the results, you can use the mssql_fetch_array as already described in the previous answer.

Taking advantage of this to indicate the strong possibility of SQL Injection in this code, in addition to the depreciation of the function in PHP 7.0 - migrate to PDO if possible.

    
01.02.2017 / 06:00
1

Now just use a while loop to work with the results:

$result = mssql_query($sql); 
while ($results = mssql_fetch_array($result)) {
    $nome = $results['nome'];
    $endereco = $results['endereco'];
    ...
}

Then you exchange the $ results [''] for the fields of your table that you want to use.

    
01.02.2017 / 01:26