Im working on a small code and am trying to limit the size of the mysql databse string its pulling.
It can only be 119 characters, or less if its more i would like to do nothing, but if its meets the requirements it runs the script.
CAN ANY ONE HELP ME?Code:int32 message_id; string_t message ="Is requesting some one to respond.";<_______________TEMP SHOULD BE THE POSTERS MESSAGE string_t username = "Guest";<_______________TEMP SHOULD BE THE POSTERS NAME // char will not be logged in so get the id manually const int8* Query = "SELECT message_id, username, message FROM phpbb_chat WHERE count = '0';"; int32 ret = Sql_Query(SqlHandle,Query); if (ret != SQL_ERROR && Sql_NumRows(SqlHandle) != 0 && Sql_NextRow(SqlHandle) == SQL_SUCCESS) { message_id = (int32)Sql_GetIntData(SqlHandle,0); username = Sql_GetData(SqlHandle,0); message = Sql_GetData(SqlHandle,1); //So here is where I'm heaving the problem if(message is less then 119 characters run script )<<_______________________________________________THIS IS THE CODE LINE IM TRYING TO LEARN { char buf[110]; sprintf(buf,"[Web Chat] %s %s",username.c_str(), message.c_str()); for (uint16 zone = 0; zone < 256; ++zone) { zoneutils::GetZone(zone)->PushPacket( NULL, CHAR_INZONE, new CChatMessageStringPacket(PChar, MESSAGE_STRING_SAY , ("%s",buf))); } ShowNotice(CL_RED"TRACER:COMMAND: CRecastContainer::Check MessageID %u Username %s Message %s \n" CL_RESET,message_id,username.c_str(),message.c_str()); } else { ShowNotice(CL_RED"TRACER:COMMAND: CRecastContainer::Check Message Is To Large and can not be posted \n" CL_RESET); } Query = "UPDATE phpbb_chat SET count = '1' WHERE message_id = %u;"; Sql_Query(SqlHandle, Query,message_id); }


Reply With Quote
Bookmarks