Raised This Month: $ Target: $400
 0% 

DB query explode


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 04-18-2011 , 15:44   DB query explode
Reply With Quote #1

Hi there,
I have a mysql table called "names" that contains the value "name1,name2,name3" .. how can i extract every single string and insert it into a variable? like var1 = name1, var2 = name2 and var3 = name3 ?

Last edited by Clauu; 04-18-2011 at 15:47.
Clauu is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-18-2011 , 21:27   Re: DB query explode
Reply With Quote #2

Code:
stock str_explode(const string[], delimiter, output[][], output_size, output_len) {     new i, pos, len = strlen(string);         do     {         pos += (copyc(output[i], output_len, string[pos], delimiter) + 1);     }     while(pos < len && ++i < output_size);         return i; }

Code:
new names[128]; // value from database new name[3][32]; // 3 = max number of values to split, 32 = max length of value str_explode(names, ',', name, sizeof(name), charsmax(name[])); // name[0] = "name1" // name[1] = "name2" // name[2] = "name3"
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 04-19-2011 , 00:05   Re: DB query explode
Reply With Quote #3

Wow, thanks a lot man And also it is possible to protect some data against decompiling softwares? like my connection details for the db? I have tried to decompile it with the wraith_disassembler and all of my db connection details where there visibile .. btw i have also decompiled an another plugin that is using a db and surprise there where no db connection details to see so seems that is possible to protect some db details but how?

Last edited by Clauu; 04-19-2011 at 00:13.
Clauu is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode