1
I have already scoured the entire internet for the solution of my problem and as a last resort, I come here to ask you and hope to find a solution to my problem, following:
I am performing a query via PHP & Mysql with the following parameters passed in the URL ../data/status.php?projeto=108&origem=Sugestão de Melhoria
By "debugging" my code next to the back end ( PHP ) I realize that it actually mounts the query correctly as below:
string(883) "SELECT mantis_bug_table.version AS VERSAO,
CASE
WHEN mantis_bug_table.version <> '' THEN
Replace(mantis_bug_table.version, '.', '')
END AS VERSAOSEMPONTO,
CASE
WHEN mantis_bug_table.status IN ( 10, 20, 30, 50 ) THEN 'EM EXECUÇÃO'
ELSE 'CONCLUÍDO'
END AS DESCRICAO,
Count(mantis_bug_table.id) AS QUANTIDADE FROM dbmantis_bugs.mantis_bug_table
INNER JOIN dbmantis_bugs.mantis_custom_field_string_table
ON ( mantis_bug_table.id = mantis_custom_field_string_table.bug_id ) WHERE ( mantis_custom_field_string_table.value = 'Sugestão de Melhoria' )
AND ( mantis_bug_table.project_id = 108 ) GROUP BY mantis_bug_table.version,
descricao ORDER BY mantis_bug_table.version ASC,
status ASC "
But when executing the query it simply does not return me any given:
object(mysqli_result)#2 (5) { ["current_field"]=> int(0) ["field_count"]=> int(4) ["lengths"]=> NULL ["num_rows"]=> int(0) ["type"]=> int(0) }
And by taking this same query and running in the database I get the following results:
NULL COMPLETED 13
1.0.0.x 100x DONE 2
1.0.1.x 101x COMPLETED 7
1.0.2.x 102x RUNNING 1
1.0.2.x 102x DONE 9
1.0.3.x 103x RUNNING 5
1.0.3.x 103x COMPLETED 5
1.0.4.x 104x RUNNING 1
1.0.4.x 104x COMPLETED 1
Follow my PHP code: http://pastebin.com/NF4p7sDz Follow the connection code: http://pastebin.com/ajSWtyBA
PS: When using any other parameter in the source that does not contain special characters, for example GRI, the results are printed on the screen in the correct way without any problem.
../data/status.php?projeto=108&origem=GRI
Give a
var_dump()
in its parameters so that it is possible to see how it has to be treated, and post in your question.– Kenny Rafael
@Kennyrafael I made a correction in the query published here, it follows the result of var_dump in my parameters: string(21) "Improvement Suggestion" string(3) "108"
– Milson Fabio Oliveira Lima
If it is coming this way is not encoding problems...are not having problems with the connection no? suggest post the connection code and query...
– Kenny Rafael
@Kennyrafael exactly is my question, because it is not encoding problem, nor connection problem because if I change the parameter to any other that does not contain spaces or special character example GRI, VARIABLE, it works :(, connection code added to the post, now the "query" part said by you, I did not understand.
– Milson Fabio Oliveira Lima
It’s true, I forgot that changing works, anyway I think it is valid to post the query, IE, the whole part that assembles your
query
– Kenny Rafael
@Kennyrafael So, the query is mounted "in the hand" I am passing the parameters through the browser itself, accessing the file and passing the parameters, including when typing improvement suggestion as parameter the browser mounts the request as follows : blabalbalba/status.php? project=108&origin=Suggestion%20de%20Best
– Milson Fabio Oliveira Lima
Yes, but in your script
php
you take all the parameters and insert intosql
right? how do you do it?– Kenny Rafael
@Kennyrafael I do as shown in the http://pastebin.com/NF4p7sDzfile, only retrieve the parameter by the $_GET attribute it to a variable and place the variable inside the String WHERE query (mantis_custom_field_string_table.value = '$origin')
– Milson Fabio Oliveira Lima