problem inserting array in mysql
Moderator: General Moderators
-
mohmedsalem
- Forum Newbie
- Posts: 2
- Joined: Fri Jul 24, 2015 9:44 pm
problem inserting array in mysql
hi guys, i want to ask how can i store an array in mysql field without mysql convert it to a normal string, i tried to make serialize on that array and store it but it still giving me it like string not an array so, i can't use arrays function like in_array() because the result that coming from the database is not array it's store it like string and fetch it in string also , i am working on rating script and i wanna to store the user id in array after he voted to prevent voting again using in_array() function to check if it's in that array or not , i am really want to know how to store an array in mysql filed without mysql convert it to string i wanna to save it from converting ... can any one help me please, and thank you again.
Re: problem inserting array in mysql
You can't store an array in a database but, more importantly, you probably don't want to.
You can use either a flag on the user's account or create an entry in a pivot table, depending on the use case. Both of these would be better solutions.i am working on rating script and i wanna to store the user id in array after he voted to prevent voting again
-
mohmedsalem
- Forum Newbie
- Posts: 2
- Joined: Fri Jul 24, 2015 9:44 pm
Re: problem inserting array in mysql
what a technique can be used in this situation ??