-4

I am trying to compare a row returned by mysql and whats extracted in my code however it keeps returning false when strlen returns the same and they output the exact same.

if(trim($checkComplete['WorkOrder']) == trim($wo)) {
    //Do nothing
} else {
    //WorkOrder does not match
    echo "WorkOrder does not match!<br>".$wo." | ". $checkCompleteAssoc['WorkOrder']."<br>";
    echo strlen($wo)."<br>";
    echo strlen($checkCompleteAssoc['WorkOrder'])."<br>";

Output:

WorkOrder does not match!
39809337 | 39809337
8
8
Taylor Reed
  • 335
  • 2
  • 6
  • 18

1 Answers1

0

I think you using wrong variable $checkComplete

if(trim($checkCompleteAssoc['WorkOrder']) == trim($wo)) {
    //Do nothing
} else {
    //WorkOrder does not match
    echo "WorkOrder does not match!<br>".$wo." | ". $checkCompleteAssoc['WorkOrder']."<br>";
    echo strlen($wo)."<br>";
    echo strlen($checkCompleteAssoc['WorkOrder'])."<br>";
Ahmed Ginani
  • 6,522
  • 2
  • 15
  • 33
  • Is this a question or an answer? – John Conde Apr 28 '17 at 12:28
  • its an answer, to just checking he did by mistake ? – Ahmed Ginani Apr 28 '17 at 12:29
  • If you aren't sure if that variable is correct or not, how can you be sure this answer is correct? And if you have to end your answer with a question mark it might not be a good answer. – John Conde Apr 28 '17 at 12:30
  • @JohnConde - You're Right, I'll improve it, Thanks :) – Ahmed Ginani Apr 28 '17 at 12:31
  • @Ahmed Ginani it should be a comment not an answer – lazyCoder Apr 28 '17 at 12:32
  • @BunkerBoy - Should I delete this ? – Ahmed Ginani Apr 28 '17 at 12:33
  • No. Since it turned out to be the right answer you should remove your question mark and make your answer a *statement*. – John Conde Apr 28 '17 at 12:34
  • @ Ahmed Ginani this can be an assumption that may work but it all up to you – lazyCoder Apr 28 '17 at 12:34
  • 1
    Your *"I think"* IMHO isn't a concrete answer, more of an uncertainty which I'm sure others share my view; this qualifies as being of low-quality. I also noticed that both [Jay Blanchard](http://stackoverflow.com/users/1011527/jay-blanchard) and I received downvotes at around the same time, since we were both present in your (now deleted and incorrect) answer http://stackoverflow.com/a/43680252/1415724 - We voiced our views and there isn't anything wrong with that. If that is the attitude that you wish to have, I can give you a good tip: **lose it.** It will do you more *harm* than **good.** – Funk Forty Niner Apr 28 '17 at 13:52