Jump to content
  • 0

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


Ninja

Question


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

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

2 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

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