Coly010 Posted October 26, 2015 Share Posted October 26, 2015 omg.. a few days away from this forum and I come back to this. No harm [MENTION=69823]jcvenom[/MENTION], i thought you would have known how to store data from the db into an array, especially when you pull data from the database it is moreless in an array already... I seriously don't understand how you have managed to get client work if you don't know that. But with that said I'm gonna try help you. You have a table in db for emojis, set it up something like this: | emoji_tag | emoji_img | | ----------- | ------------ | | =) | smile.gif | etc then in PHP you want to use your mysqli functions to receive the data from the database $i = 0; $q = mysqli_query($c, "SELECT * FROM emojis"); while($r = mysqli_fetch_assoc($q)){ $emojis['tag'][] = "/".$r['emoji_tag']."/"; $emojis['src'][] = "<img src='".$r['emoji_img']."' />"; $i++; } It's as simple as that... (which is actually a bit more complex than needs be, its just so you can set the array up how you want it, which may help with your replacing as you'll see below) then I'd suggest preg_replace like: preg_replace($emojis['tag'], $emojis['src'], $message); This is untested and I'm not sure if it would work, but you get the idea. Quote Link to comment Share on other sites More sharing options...
jcvenom Posted October 27, 2015 Author Share Posted October 27, 2015 (edited) omg.. a few days away from this forum and I come back to this. No harm [MENTION=69823]jcvenom[/MENTION], i thought you would have known how to store data from the db into an array, especially when you pull data from the database it is moreless in an array already... I seriously don't understand how you have managed to get client work if you don't know that. But with that said I'm gonna try help you. You have a table in db for emojis, set it up something like this: | emoji_tag | emoji_img | | ----------- | ------------ | | =) | smile.gif | etc then in PHP you want to use your mysqli functions to receive the data from the database $i = 0; $q = mysqli_query($c, "SELECT * FROM emojis"); while($r = mysqli_fetch_assoc($q)){ $emojis['tag'][] = "/".$r['emoji_tag']."/"; $emojis['src'][] = "<img src='".$r['emoji_img']."' />"; $i++; } It's as simple as that... (which is actually a bit more complex than needs be, its just so you can set the array up how you want it, which may help with your replacing as you'll see below) then I'd suggest preg_replace like: preg_replace($emojis['tag'], $emojis['src'], $message); This is untested and I'm not sure if it would work, but you get the idea. Thanks for the example :) , but I've already figured it out and my system I've built works fine, all I was confused about was how to create an array with my while loop results, I've also tried it this way prior to you posting this, and to answer your question about client work I've never done something like this... That's why I posted here to maybe get an explanation from those better than me with a better understanding. Thank you anyways hope that answers your question Edited October 27, 2015 by jcvenom Quote Link to comment Share on other sites More sharing options...
jcvenom Posted October 27, 2015 Author Share Posted October 27, 2015 (edited) omg.. a few days away from this forum and I come back to this. No harm [MENTION=69823]jcvenom[/MENTION], i thought you would have known how to store data from the db into an array, especially when you pull data from the database it is moreless in an array already... I seriously don't understand how you have managed to get client work if you don't know that. But with that said I'm gonna try help you. You have a table in db for emojis, set it up something like this: | emoji_tag | emoji_img | | ----------- | ------------ | | =) | smile.gif | etc then in PHP you want to use your mysqli functions to receive the data from the database $i = 0; $q = mysqli_query($c, "SELECT * FROM emojis"); while($r = mysqli_fetch_assoc($q)){ $emojis['tag'][] = "/".$r['emoji_tag']."/"; $emojis['src'][] = "<img src='".$r['emoji_img']."' />"; $i++; } It's as simple as that... (which is actually a bit more complex than needs be, its just so you can set the array up how you want it, which may help with your replacing as you'll see below) then I'd suggest preg_replace like: preg_replace($emojis['tag'], $emojis['src'], $message); This is untested and I'm not sure if it would work, but you get the idea. I'm no longer coding for clients either, which doesn't mean I can't develop either I still have 3 and half years experience on me. I had a thought about that and I really want to be prepared and I want to correct myself so I can be up to standard, can't be delivering code that's not meeting standards e.g OOP so I've taken a break from that and finishing my studies and hopefully I'll into manchester uni for computer science and develop in a proper developer there. Anyways I'm working on my game and hope to have it released later this month hopefully, It's hard work working by yourself with such work loads but I've been building it since april and It's going all good Edited October 27, 2015 by jcvenom Quote Link to comment Share on other sites More sharing options...
~Rob0t Posted October 27, 2015 Share Posted October 27, 2015 (edited) Thanks for the example :) , but I've already figured it out and my system I've built works fine, all I was confused about was how to create an array with my while loop results, I've also tried it this way prior to you posting this, and to answer your question about client work I've never done something like this... That's why I posted here to maybe get an explanation from those better than me with a better understanding. Thank you anyways hope that answers your question But...what. Really? I'm sure you have. I'm not digging you here, but I'm pretty sure you have done this before. --- Edit --- Scratch the above. Looked through your started threads (excluding your other account; [MENTION=69347]crimec[/MENTION]) and you've only done it in your new jail mod on line 27 - which is incorrect also. So yes, maybe you've actually not done this before... Weird. Edited October 27, 2015 by ~Rob0t Quote Link to comment Share on other sites More sharing options...
IllegalPigeon Posted October 27, 2015 Share Posted October 27, 2015 But...what. Really? I'm sure you have. I'm not digging you here, but I'm pretty sure you have done this before. --- Edit --- Scratch the above. Looked through your started threads (excluding your other account; [MENTION=69347]crimec[/MENTION]) and you've only done it in your new jail mod on line 27 - which is incorrect also. So yes, maybe you've actually not done this before... Weird. That's not the point, it's such a basic task. Someone who claimed to learn OOP in 2 weeks would have the brain capacity to figure this VERY BASIC issue. I'd have no problem helping him if he didn't make absurd claims in the past, like learning OOP in 2 weeks or stating that he's "learnt PHP in 1 year" (as he did make that claim). If he just admitted months ago he has no idea how to code then people, like myself, would have no problem answering questions without the sarcasm. And yes, when I say "no idea how to code", I mean it. Case in point? Re-read this thread. Quote Link to comment Share on other sites More sharing options...
jcvenom Posted October 27, 2015 Author Share Posted October 27, 2015 That's not the point, it's such a basic task. Someone who claimed to learn OOP in 2 weeks would have the brain capacity to figure this VERY BASIC issue. I'd have no problem helping him if he didn't make absurd claims in the past, like learning OOP in 2 weeks or stating that he's "learnt PHP in 1 year" (as he did make that claim). If he just admitted months ago he has no idea how to code then people, like myself, would have no problem answering questions without the sarcasm. And yes, when I say "no idea how to code", I mean it. Case in point? Re-read this thread. You're wasting your time, bringing up the past, maybe you misinterpreted what I stated at the start, or maybe I didn't explain in a more simplified way for you to understand. I really don't care about what you're saying, you're the only one here trying to look for trouble whereas everyone else has applied themselves to my question and helped me understand something I already know period!. Quote Link to comment Share on other sites More sharing options...
Coly010 Posted October 27, 2015 Share Posted October 27, 2015 You're wasting your time, bringing up the past, maybe you misinterpreted what I stated at the start, or maybe I didn't explain in a more simplified way for you to understand. I really don't care about what you're saying, you're the only one here trying to look for trouble whereas everyone else has applied themselves to my question and helped me understand something I already know period!. If you say you already know it, expect [MENTION=71663]IllegalPigeon[/MENTION] to hit back with something along the lines of "if you already knew it you wouldn't have asked for help." Just be careful what you say. But this is getting off topic. You said you got a solution to your problem? Post it here so others can learn from it Quote Link to comment Share on other sites More sharing options...
~Rob0t Posted October 27, 2015 Share Posted October 27, 2015 You're wasting your time, bringing up the past, maybe you misinterpreted what I stated at the start, or maybe I didn't explain in a more simplified way for you to understand. I really don't care about what you're saying, you're the only one here trying to look for trouble whereas everyone else has applied themselves to my question and helped me understand something I already know period!. VIP seating in the front with hot fresh popcorn, please! Okay, I'm ready. Go! Quote Link to comment Share on other sites More sharing options...
IllegalPigeon Posted October 27, 2015 Share Posted October 27, 2015 Why not use preg_replace_callback, as below; Also, you cannot be serious with this.... please don't be serious with that. regex($content, ':/(*){0:10}:'); This is very basic PHP This is a genuine question?! (tagging you in [MENTION=71663]IllegalPigeon[/MENTION]) No harm [MENTION=69823]jcvenom[/MENTION], i thought you would have known how to store data from the db into an array, especially when you pull data from the database it is moreless in an array already... I seriously don't understand how you have managed to get client work if you don't know that. These are all comments pointing out how much of a div you are. They are indirectly pointing out that you lack very simple brain functionality that prohibits you from figuring out the answer to a question someone with 3 days PHP experience could answer. To quote Coly; if you already knew it you wouldn't have asked for help. If you have to ask for help doing something, you don't know how to do it. How is that hard to understand? Don't get the answer off of people and then claim you already knew the answer, that makes you look even more simple than you already do. Also, on that note, today I learned something; jcvenom CAN appear more retarded than I first thought. Quote Link to comment Share on other sites More sharing options...
Sim Posted October 27, 2015 Share Posted October 27, 2015 Who cares what he knows? I LIKE seeing how many different ways people come up how to do something Quote Link to comment Share on other sites More sharing options...
IllegalPigeon Posted October 27, 2015 Share Posted October 27, 2015 Who cares what he knows? I LIKE seeing how many different ways people come up how to do something I can't tell if this is sarcasm or not. I really hope it is. Quote Link to comment Share on other sites More sharing options...
jcvenom Posted October 27, 2015 Author Share Posted October 27, 2015 These are all comments pointing out how much of a div you are. They are indirectly pointing out that you lack very simple brain functionality that prohibits you from figuring out the answer to a question someone with 3 days PHP experience could answer. To quote Coly; if you already knew it you wouldn't have asked for help. If you have to ask for help doing something, you don't know how to do it. How is that hard to understand? Don't get the answer off of people and then claim you already knew the answer, that makes you look even more simple than you already do. Also, on that note, today I learned something; jcvenom CAN appear more retarded than I first thought. ok, well i appreciate the help from everyone else thank you Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted October 27, 2015 Share Posted October 27, 2015 Closed per OP's request. But I would like to end on this note: Regardless of what is claimed to be known vs. what is claimed is not known, I feel this thread could help a lot of people. Regardless of the "array" stuff, I agree with sim here in regards to loosing to see how people would tackle emojis, bccode, and etc. most of these posts did provide alternatives to one another which is great to see especially here. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.