Jump to content
  • 0

SQL Command 'INSERT INTO' [solved]


mina

Question


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   2
  • Joined:  10/25/13
  • Last Seen:  

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
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  11
  • Reputation:   3
  • Joined:  11/07/17
  • Last Seen:  

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
Link to comment
Share on other sites

  • -1

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   2
  • Joined:  10/25/13
  • Last Seen:  

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
Link to comment
Share on other sites

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.

×
×
  • Create New...