Raised This Month: $ Target: $400
 0% 

Sql Problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
[M]xxxx
Member
Join Date: May 2008
Location: Estonia
Old 02-25-2009 , 00:09   Sql Problem
Reply With Quote #1

What wrong?
Code:
L 02/24/2009 - 19:50:12: [MySQL] Invalid DBI result handle -1
L 02/24/2009 - 19:50:12: [AMXX] Displaying debug trace (plugin "sms.amxx")
L 02/24/2009 - 19:50:12: [AMXX] Run time error 10: native error (native "dbi_field")
L 02/24/2009 - 19:50:12: [AMXX]    [0] phpwVdTWV.sma::func_get_sms (line 40)
.sma
Code:
#include <amxmodx>
#include <amxmisc>
#include <dbi>

#define PLUGIN "Plugin"
#define VERSION "Version"
#define AUTHOR "Author"

#define hostname "hostname"
#define sqluser "sqluser"
#define sqlpass "sqlpass"
#define sqldb "sqldb"

new Sql:dbc;
new Result:result;

public plugin_init()
{
  register_plugin(PLUGIN, VERSION, AUTHOR);
  register_clcmd("say /sms", "Show_Sms_Motd");
  register_clcmd("say_team /sms", "Show_Sms_Motd");
  
  new error[289];
  dbc = dbi_connect(hostname, sqluser, sqlpass, sqldb, error, 288);
  
  set_task(300.0, "func_get_sms", 0, "", 0, "b")
}

public Show_Sms_Motd(id)
{
       show_motd(id, "sms.txt")
}

public func_get_sms()
{
result = dbi_query(dbc, "SELECT `Time`, `Message` FROM `sms_chat` ORDER BY `Time` DESC");
new field1;
new field2[32];

field1 = dbi_field(result, 1);
dbi_field(result, 2, field2, 31);

client_print(0, print_chat, "LAST SMS: on %d, with text %s", field1, field2);
}
It dosent show message :S
if i but time to like 25 sec it does about 4-5 times then same error starts
and compling dosent give me any errors
[M]xxxx is offline
Send a message via MSN to [M]xxxx
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode