Hello
I have a script that checks mysql for dupe values. This is working ok. However because it is a multiple I need to know which record is already in the db. I have a feeling that I need to do a while loop but need help to do so.
What I am trying to do is find which item is the dupe and echo it out.
The variables $outString. = “$box”. " "; and $boxitem = $box; are used further on to insert if there are no dupes. I shall change the else statement.
I would be grateful if someone could help with this. many thanks
You’re escaping a variable that is expected to be an array or imploding a variable that is expected to be a string. Both those things contradict one another. If you expect a value to be an array than you need to escape each value in the array separately, rebuilding the array. I’m surprised your code gets past that first line unless the value isn’t an array.
ZooKeeper
Can we take that out the equation for the moment and help me to display which is the dupe item. Do i have to do a while loop to cycle through the $result? Not sure. Thanks
I really don’t understand this code. What is [‘one’,‘two’, ‘three’]? This is what is showing in inspector when i post to the php script: [“aaa”,“ggg”] and it is these values I need to check for dupe. That value is obviously dynamic. Sorry to be a pain. Thanks
I have tried while loop but it is only showing 1 result and there should be 2. based on my original code, how would you code for displaying dupe values to user. Thanks
Think I have sorted it thanks John. There were 2 grey areas. 1 was the exit; and the other was I changed >1 to >0 in the select query and it is now working. Many thanks for reply. I shall update title to solved.