Jump to content
  • 0

SQL Command 'INSERT INTO' [solved]


Question

Posted (edited)

Hello everyone, my English is not good, Sorry!

I gonna add a 'SQL Command' source

if (SQL_ERROR == Sql_Query(mmysql_handle, "INSERT INTO `acc_reg_num`(`account_id`, `key`, `index`, `value`) VALUES ('%d,%s,%u,%d')",
	acc_reg_num_table, sd->status.account_id, "#bonuspoint", '0', value))
Sql_ShowDebug(mmysql_handle);

but, it crashes when executed.

How can I solve it ?

 

thanks guys!

I have solved it myself

Edited by mina

3 answers to this question

Recommended Posts

  • 0
Posted (edited)

Can try something like this

if (Sql_Query(mmysql_handle, "INSERT INTO `acc_reg_num`(`account_id`, `key`, `index`, `value`) VALUES ('%d','%s','%u','%d');",	
              acc_reg_num_table, sd->status.account_id, "#bonuspoint", '0') != SQL_SUCCESS)
	Sql_ShowDebug(mmysql_handle);

 

Edited by Psychonaut
  • -1
Posted (edited)
On 2017/11/7 at 6:20 PM, Psychonaut said:

Can try something like this


if (Sql_Query(mmysql_handle, "INSERT INTO `acc_reg_num`(`account_id`, `key`, `index`, `value`) VALUES ('%d','%s','%u','%d');",	
              acc_reg_num_table, sd->status.account_id, "#bonuspoint", '0') != SQL_SUCCESS)
	Sql_ShowDebug(mmysql_handle);

 

i tried it~ But the error message pops up

: DB error - Duplicate entry '2000000-#bonuspoint-0' for key 'PRIMARY'


thanks guys!

I have solved it myself

Edited by mina

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...