Raised This Month: $51 Target: $400
 12% 

SQL Char Support


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 11-30-2019 , 00:00   SQL Char Support
Reply With Quote #1

When I use MySQL to insert the name in a table , its unable to store character as it is instead it shows something weird character.
I have tried NVARCHAR didn't worked.

How to fix this issue?
In MySQL Table : SkY#IN
__________________

Last edited by Sanjay Singh; 11-30-2019 at 11:38.
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 11-30-2019 , 04:49   Re: SQL Char Support
Reply With Quote #2

SQL_SetCharset(g_SqlTuple,"utf8");
__________________
Airkish is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 11-30-2019 , 07:16   Re: SQL Char Support
Reply With Quote #3

Quote:
Originally Posted by Airkish View Post
SQL_SetCharset(g_SqlTuple,"utf8");
where to use this code?
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-30-2019 , 10:45   Re: SQL Char Support
Reply With Quote #4

I just ran a test using SQLite and had no issues

'INSERT INTO tblPlayerData (PlayerName) VALUES ('SkY#IN');'

Show me your SQL statement. Also, try what Airkish suggested, place that line after 'g_SqlTuple = SQL_MakeDbTuple()'
__________________
Bugsy is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 11-30-2019 , 10:49   Re: SQL Char Support
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
I just ran a test using SQLite and had no issues

'INSERT INTO tblPlayerData (PlayerName) VALUES ('SkY#IN');'

Show me your SQL statement. Also, try what Airkish suggested, place that line after 'g_SqlTuple = SQL_MakeDbTuple()'
idk i used above SQL charset command and now i can see that character in phpmyadmin table but not able to get that character in Website Stats.
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-30-2019 , 10:52   Re: SQL Char Support
Reply With Quote #6

Not sure how to help you with that as it's likely not AMX-X related.
__________________
Bugsy is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 11-30-2019 , 10:55   Re: SQL Char Support
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
I just ran a test using SQLite and had no issues

'INSERT INTO tblPlayerData (PlayerName) VALUES ('SkY#IN');'

Show me your SQL statement. Also, try what Airkish suggested, place that line after 'g_SqlTuple = SQL_MakeDbTuple()'
Edit: I have fixed website stats but

only 1 time i have to add this line before connection or every time ? :"SQL_SetCharset(g_SqlTuple,"utf8");"
__________________

Last edited by Sanjay Singh; 11-30-2019 at 11:00.
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-30-2019 , 11:26   Re: SQL Char Support
Reply With Quote #8

You should only create the tuple one time in your plugin, in plugin_init() or plugin_cfg(), so you only need to call the SetCharset() once as well.
__________________
Bugsy is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 11-30-2019 , 11:35   Re: SQL Char Support
Reply With Quote #9

Quote:
Originally Posted by Bugsy View Post
You should only create the tuple one time in your plugin, in plugin_init() or plugin_cfg(), so you only need to call the SetCharset() once as well.
ok thanks buddy solved all my issues
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-30-2019 , 11:42   Re: SQL Char Support
Reply With Quote #10

No problem, chief.
__________________
Bugsy 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 13:14.


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