List:General Discussion« Previous MessageNext Message »
From:Tom Lobato Date:April 23 2006 11:39pm
Subject:Re: WHERE doesn't work
View as plain text  
    Solved =)


From: "Quentin Bennett" <Quentin.Bennett@stripped>
>Have you tried turning on the logging on the MySQL server, and seeing
>exactly what command the server is receiving - it may be different from the
>one (you
>think) you are sending.

    Turning on the logging on the MySQL server, I saw PHP didn't send to
mysql server the final part (which contain WHERE id = 5) of the command
string $command. But when I echo'ed the $command to the browser, WHERE id =
5 was there. So, likely, the string $command hold the trouble. When I tried
*trim the string $value before execute mysql_query("UPDATE ... $value WHERE
id = $i") it worked. Why? On line 54 of
http://www.spalha.com.br/spalha/insert_client_code.html it is inserted the
char "\0" to the string $value, that will be interpolated to the $command,
and this char ('', or NULL) prevents mysql api of the PHP from send the rest
of the string to the sever.

    Solution:     1) Insert ' ' to $values instead ''.
                    OR
                      2) trim $values before interpolate it in $command.

* function trim() in PHP removes some especials chars (" ", "\t", "\0", ...)
from begin end end of the string.

    I don't know if I was clear, but hope to be explained well the solution.
    In two words, the problem was in my PHP script: a NULL char (ascii 0)
inside the string passed to mysql_query($command), which prevented final
part of the commnad, contained the WHERE, to be read.

    Thanks very much to all Sherlocks and Watsons who helped me solve it =)




    Tom

Thread
WHERE doesn't workTom Lobato20 Apr
  • Re: WHERE doesn't workBarry21 Apr
  • Re: WHERE doesn't workPeter Brawley23 Apr
  • Re: WHERE doesn't workTom Lobato23 Apr
    • Re: WHERE doesn't workPeter Brawley23 Apr
  • Re: WHERE doesn't workTom Lobato23 Apr
RE: WHERE doesn't workJay Blanchard20 Apr
  • Re: WHERE doesn't workTom Lobato20 Apr
RE: WHERE doesn't workGeorge Law20 Apr
Re: WHERE doesn't workTom Lobato21 Apr
  • RE: WHERE doesn't workNicolas Verhaeghe21 Apr
    • Re: WHERE doesn't workTom Lobato21 Apr
      • RE: WHERE doesn't workNicolas Verhaeghe21 Apr
      • RE: WHERE doesn't workNicolas Verhaeghe21 Apr
        • Re: WHERE doesn't workTom Lobato21 Apr
          • RE: WHERE doesn't workNicolas Verhaeghe21 Apr
            • Re: WHERE doesn't workTom Lobato22 Apr
              • Re: WHERE doesn't workMichael Stassen22 Apr
  • RE: WHERE doesn't workNicolas Verhaeghe21 Apr
Re: WHERE doesn't workTom Lobato21 Apr
Re: WHERE doesn't workTom Lobato21 Apr
Re: WHERE doesn't workTom Lobato21 Apr
RE: WHERE doesn't workJay Blanchard21 Apr
  • Re: WHERE doesn't workTom Lobato21 Apr
Re: WHERE doesn't workTom Lobato24 Apr