PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <sqlx>
new cvar_hostname
new Handle: gSqlTuple
new Handle: SqlConnection
new gError[512]
new ErrorCode
public plugin_init()
{
register_plugin("SQLx Test", "0.1.1", "fezh")
register_concmd("sqlx_test", "concmd_test")
cvar_hostname = get_cvar_pointer("hostname")
set_task(0.5, "sql_init")
}
public sql_init()
{
gSqlTuple = SQL_MakeDbTuple("xxxx.thost.com.ar", "enzo_xxxxxxx", "xxxxxxx", "enzo_xxxxxxxxxxx")
SqlConnection = SQL_Connect(gSqlTuple, ErrorCode, gError, 511)
if (SqlConnection == Empty_Handle)
{
set_fail_state(gError)
}
new Handle: Query = SQL_PrepareQuery(SqlConnection, "CREATE TABLE IF NOT EXISTS `sqlx_amxx` (`hostname` VARCHAR(33), `date` VARCHAR(33)")
if (!SQL_Execute(Query))
{
SQL_QueryError(Query, gError, 511)
set_fail_state(gError)
}
}
public concmd_test(id)
{
new servername[64], time[32]
get_pcvar_string(cvar_hostname, servername, charsmax(servername))
get_time("%d/%m/%Y - %H:%M:%S", time, charsmax(time))
new Handle: Query = SQL_PrepareQuery(SqlConnection, "INSERT INTO `sqlx_amxx` VALUES ('%s', '%s')", servername, time)
if (!SQL_Execute(Query))
{
SQL_QueryError(Query, gError, 511)
set_fail_state(gError)
}
SQL_FreeHandle(Query)
SQL_FreeHandle(SqlConnection)
}
Is there something bad in this code or is only a problem with web hosting?
__________________