When I look in my error file it says Wrong datatype for second argument for the following code.
What is wrong in this one? Can anyone explain what I should change? It seems to work when I run it, but I don’t like the error message.
Hmmm, there is no error at all when changing the code either. It’s just a file on the hosting server, called error_log that is listing this error. Otherwise it seems to work fine. The result is inserted into the db.
I just thought it would be nice to get rid of the error… whatever it might be.
By the way… is it hard to change things from mysql to mysqli? I’ve done quite a lot of things on this one and it’s almost ready…
The error message I get is this:
PHP Warning: in_array() [<a href=‘function.in-array’>function.in-array</a>]: Wrong datatype for second argument in thefilename.php
I removed the quotes. And how do I solve it if the music genre isn’t an array?
Thank you oddz. I started looking for where in the script $music_genre was set and all of a sudden I remember that it was a part of another thought I had that I skipped later. So this line was probably something I worked on earlier and now got back to. Then I changed bits and pieces around it and I fugured out that I actually don’t need that one.
Now I wrote the whole part again and it works without the error part. Sorry, it’s been a while since I worked with this page and always hard to get back into the way I was thinking before.
And I have a loop around this that I made before that is working fine. I guess I was thinking about a loop or not when I was working with the page.
And thanx SpacePhoenix for the reminder about sanitizing. I have that in a lot of places in this script and I probably just forgot it here. I will try to search for it all over my code now and make sure it’s a part of it.
And then I will probably start to change everything to MySqli… and that sounds really sad… after all the work…
And I’m also working in Dreamweaver that doesn’t support mysqli… only because I’m always a beginner and play around with php. Then Dreamweaver is helping me out a lot… since it’s the way I once learned this a couple of years ago… the wrong way I suppose.
And I’m 51 yo and not really happy to start learning the things all over again, the right way…