Jump to content

Imploded Array in MySQL


klyxgaming

Recommended Posts

sql v5

php v5

from searching I have seen many solutions that are CLOSE to what I am looking for however i am restricted in what i can do.

 

SAMPLE DATA

field: allgenreid

data: 1,3,6,12

 

field: genreid

data: 3

 

for example these games genres. the genre are games MAIN genre. the genreid is the same game with other genres it may have as well - example the main genre is 3 comedy. allgenreid will show other genres this movie has

 

what I tried was

sql ='SELECT * FROM game_data WHERE allgenreid LIKE %3%'

so it will cycle through the whole data base using the allgenre to show any game with similar qualities. problem is that it doesn't work.

if i do just:

sql = 'SELECT * FROM game_data WHERE genreid=$gid'

then it works but then the user misses out on seeing the others. I would like to be able to use the allgenreid instead of the genreid

 

I tried REGEXP but that didn't seem to work, and LIKE did not produce the desired results, I can do this in a separate file, however i am checking first to see if there is a way to pull it with the SELECT command - if possible

 

Link to comment
https://forums.phpfreaks.com/topic/192771-imploded-array-in-mysql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.