Jump to content
  • 0

[SOLVED]how to correctly define Sql_handle to do queries?


Question

Posted (edited)

just another quickie.

im getting this from the map_server

[Debug]: at c:\users\user\desktop\rathena r16625	runk\src\common\custom.c:92 -
self is NULL

and here's a glimpse of custom.c (custom.c is a mod I made)

	
uint16 get_sql_charid_practice(uint32 charid) //sql_read practice
{
Sql * sql_handle = NULL;
if(SQL_ERROR == Sql_Query(sql_handle,"SELECT *  from  `char` WHERE `char_id`='%d'",charid))
{		
	Sql_ShowDebug(sql_handle);
	return 0;
}
return 1;
}

I'm definitely sure its about sql_handle being 'NULL' any hint on how to do this right?

Edited by jezznar

2 answers to this question

Recommended Posts

Posted

because you didnt select anything from the table ??

Sql_Query(sql_handle,"SELECT from  `char` WHERE `char_id`='%d'",charid)

you have skipped what to select from the table

Posted (edited)

i tried

"SELECT * from `char` WHERE `char_id`='%d'",charid

still doesnt work..

//edited first post to this one

solved by

sql_handle = Sql_Malloc();

"SELECT `char_id` from `char` where `char_num`=1"

finally got the logic right. I just needed to get some sleep LOL

Edited by jezznar

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...