Raised This Month: $ Target: $400
 0% 

SQL Problem with "|"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nikol4u
Member
Join Date: Jan 2007
Location: Burgas
Old 10-19-2007 , 08:46   SQL Problem with "|"
Reply With Quote #1

Well, i got query and the code is like this:

Code:
            formatex(query,127, "INSERT INTO `%s` VALUES('%s','%s','%s','%s','%d:%02d','**:**','knife','%s')",sql_table,mapname,name,getcountry,authid,(climbertime[id]/60), (climbertime[id]%60),ip)
            SQL_ThreadQuery(g_SqlTuple,"addtomysql",query)
Code:
public addtomysql(failstate,Handle:query,error[],errnum,data[],size) {
    if(failstate == TQUERY_CONNECT_FAILED) {
        log_amx("Couldn't connect to SQL database.")
        client_print(0,print_chat,"[%s] Can't connect to the DB to add you in Top15 DB",ct_pluginname)
    }
    else if(failstate == TQUERY_QUERY_FAILED) {
        log_amx("Query failed.") 
        client_print(0,print_chat,"[%s] Something is wrong with Top15 DB",ct_pluginname)
    }
    else if(errnum) log_amx("Error #%d: %s",errnum,error)

    else {
        client_print(0,print_chat,"[%s] Added You Successfully to Top15 DB",ct_pluginname)
    }
}
If my nick is "Nikol4u" everything is OK it adds me to the db but if my nick is "Something|Nikol4u" it doesnt add me :S how to avoid this?
__________________
www.cosy-climbing.net - The official Kreedz community for non-official Kreedz maps

Cosy-Climbing's server IP: 108.61.254.236:27015
Nikol4u is offline
Send a message via ICQ to Nikol4u Send a message via Skype™ to Nikol4u
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 10-19-2007 , 10:15   Re: SQL Problem with "|"
Reply With Quote #2

http://support.microsoft.com/default.aspx/kb/178070

replace( the_guys_name, "|", chr(124) );

However, I don't think amxx or pawn has chr() hardcoded in, and I can't think of the correct func off the top of my head.

Can someone who knows the name of the func please reply with it?
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
Nikol4u
Member
Join Date: Jan 2007
Location: Burgas
Old 10-19-2007 , 14:10   Re: SQL Problem with "|"
Reply With Quote #3

A BIG THX DUDE <3

btw i used this:

Code:
 replace_all(name,31,"'","\'");
THX AGAIN <3
__________________
www.cosy-climbing.net - The official Kreedz community for non-official Kreedz maps

Cosy-Climbing's server IP: 108.61.254.236:27015
Nikol4u is offline
Send a message via ICQ to Nikol4u Send a message via Skype™ to Nikol4u
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 01:20.


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