[HELP] MySQL INSERT INTO query.
#1

So, I have this query to insert some information into table 'mdc', the sole purpose for adding offline crimes.

pawn Код:
forward OnCrimeAddOffline(iPlayerID, szAddCrime[], szPName[], iExtra);
public OnCrimeAddOffline(iPlayerID, szAddCrime[], szPName[], iExtra)
{

    new
        iRows,
        iTempID;

    iRows = cache_get_row_count(MainPipeline);

    switch(iExtra) {
        case 0: {
           
            if(!iRows) return SendClientMessageEx(iPlayerID, 0xFFFFFF, "That player was not found!");


            iTempID = cache_get_field_content_int(iRows, "id", MainPipeline);

            format(szMiscArray, sizeof(szMiscArray), "INSERT INTO `mdc` (`id` ,`time` ,`issuer` ,`crime`, `origin`) VALUES ('%d',NOW(),'%s','%s','%d')", iTempID, GetPlayerNameEx(iPlayerID), szAddCrime, arrGroupData[PlayerInfo[iPlayerID][pMember]][g_iAllegiance]);
            mysql_function_query(MainPipeline, szMiscArray, true, "OnCrimeAddOffline", "dssd", iPlayerID, szAddCrime, szPName, 1);

            DeletePVar(iPlayerID, "OfflineSU");
        }

        case 1: {
           
            if(!cache_affected_rows(MainPipeline)) return SendClientMessageEx(iPlayerID, 0xFFFFFF, "There was an issue appending that crime!");

            format(szMiscArray, sizeof(szMiscArray), "Crime Added: %s - %s", szPName, szAddCrime);
            SendClientMessage(iPlayerID, 0xFFFFFF, szMiscArray);
        }
    }


    return 1;
}
It does return saying "Crime added, blah blah". However, the crimes are not showing up in the table. It's as if it's not inserting anything (because it's not)

Any suggestions?
Reply
#2

Check server logs for the error, if none are present, add this somewhere inside of your gamemode, re run the command and review the errors.

PHP код:
public OnQueryError(erroriderror[], callback[], query[], connectionHandle)
{
    new 
string[100];
    
printf("Error ID: %i"errorid);
    
printf("Error: %s"error);
    
printf("Callback: %s"callback);
    
printf("Query: %s"query);
    return 
1;

Reply
#3

Quote:
Originally Posted by itsCody
Посмотреть сообщение
Check server logs for the error, if none are present, add this somewhere inside of your gamemode, re run the command and review the errors.

PHP код:
public OnQueryError(erroriderror[], callback[], query[], connectionHandle)
{
    new 
string[100];
    
printf("Error ID: %i"errorid);
    
printf("Error: %s"error);
    
printf("Callback: %s"callback);
    
printf("Query: %s"query);
    return 
1;

Already have that defined. No errors are showing up in the console unfortunately.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)