<div>Hello everyone,<br /><br />i need help for codding i dont know c# codding.. Years ago i was using it and Exolent helped me but now its giving error..<br /><br />Code :<br /><div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">Code:</div>
<hr /><code style="margin:0px" dir="ltr" style="text-align:left">#include <amxmodx><br />#include <sqlx><br /><br />#define SQL_HOST "localhost"<br />#define SQL_USER "*****"<br />#define SQL_PASS "*****"<br />#define SQL_DB "*******"<br />public plugin_init()<br />{<br /> register_plugin("Plugin List to SQL", "0.0.1", "Exolent");<br /> register_concmd("amx_musti", "musti", ADMIN_CFG, "asdas")<br />}<br /><br />public plugin_cfg()<br />{<br /> new Handle:tuple = SQL_MakeDbTuple(SQL_HOST, SQL_USER, SQL_PASS, SQL_DB);<br /> <br /> if(tuple == Empty_Handle) return log_amx("Failed to make SQL tuple");<br /> <br /> new errcode, error[128];<br /> new Handle:db = SQL_Connect(tuple, errcode, error, charsmax(error));<br /> <br /> if(db == Empty_Handle) return log_amx("Failed connecting to db (%d): %s", errcode, error);<br /> <br /> new Handle:query = SQL_PrepareQuery(db,<br /> "CREATE TABLE IF NOT EXISTS plugin_list <br /> (filename VARCHAR(64) NOT NULL, <br /> name VARCHAR(64) NOT NULL, <br /> author VARCHAR(64) NOT NULL, <br /> version VARCHAR(32) NOT NULL);");<br /> <br /> if(!SQL_Execute(query))<br /> {<br /> SQL_QueryError(query, error, charsmax(error));<br /> log_amx("Error on create table: %s", error);<br /> }<br /> <br /> SQL_FreeHandle(query);<br /><br /> query = SQL_PrepareQuery(db, "DELETE FROM plugin_list;");<br /> <br /> if(!SQL_Execute(query))<br /> {<br /> SQL_QueryError(query, error, charsmax(error));<br /> log_amx("Error on emptying table: %s", error);<br /> }<br /> <br /> SQL_FreeHandle(query);<br /> <br /> new filename[64], name[64], author[64], version[32];<br /> new pluginsnum = get_pluginsnum();<br /> <br /> static query_all[1024];<br /> new len = copy(query_all, charsmax(query_all),<br /> "INSERT INTO plugin_list <br /> (filename, name, author, version) <br /> VALUES");<br /> <br /> for(new i = 0; i < pluginsnum; i++)<br /> {<br /> get_plugin(i, filename, charsmax(filename), name, charsmax(name), version, charsmax(version), author, charsmax(author));<br /> <br /> len += formatex(query_all[len], charsmax(query_all) - len, "%s (^"%s^", ^"%s^", ^"%s^", ^"%s^")", i ? "," : "", filename, name, author, version);<br /> }<br /> <br /> query = SQL_PrepareQuery(db, "%s;", query_all);<br /> <br /> if(!SQL_Execute(query))<br /> {<br /> SQL_QueryError(query, query_all, charsmax(query_all));<br /> log_amx("Error on adding plugins: %s", query_all);<br /> }<br /> <br /> SQL_FreeHandle(query);<br /> <br /> SQL_FreeHandle(db);<br /> <br /> return 1;<br />} <br /><br />public musti()<br />{<br /> new Handle:tuple = SQL_MakeDbTuple(SQL_HOST, SQL_USER, SQL_PASS, SQL_DB);<br /> <br /> if(tuple == Empty_Handle) return log_amx("Failed to make SQL tuple");<br /> <br /> new errcode, error[128];<br /> new Handle:db = SQL_Connect(tuple, errcode, error, charsmax(error));<br /> <br /> if(db == Empty_Handle) return log_amx("Failed connecting to db (%d): %s", errcode, error);<br /> <br /> new Handle:query = SQL_PrepareQuery(db,<br /> "CREATE TABLE IF NOT EXISTS plugin_list <br /> (filename VARCHAR(64) NOT NULL, <br /> name VARCHAR(64) NOT NULL, <br /> author VARCHAR(64) NOT NULL, <br /> version VARCHAR(32) NOT NULL);");<br /> <br /> if(!SQL_Execute(query))<br /> {<br /> SQL_QueryError(query, error, charsmax(error));<br /> log_amx("Error on create table: %s", error);<br /> }<br /> <br /> SQL_FreeHandle(query);<br /> <br /> query = SQL_PrepareQuery(db, "DELETE FROM plugin_list;");<br /> <br /> if(!SQL_Execute(query))<br /> {<br /> SQL_QueryError(query, error, charsmax(error));<br /> log_amx("Error on emptying table: %s", error);<br /> }<br /> <br /> SQL_FreeHandle(query);<br /> <br /> new filename[64], name[64], author[64], version[32];<br /> new pluginsnum = get_pluginsnum();<br /> <br /> static query_all[1024];<br /> new len = copy(query_all, charsmax(query_all),<br /> "INSERT INTO plugin_list <br /> (filename, name, author, version) <br /> VALUES");<br /> <br /> for(new i = 0; i < pluginsnum; i++)<br /> {<br /> get_plugin(i, filename, charsmax(filename), name, charsmax(name), version, charsmax(version), author, charsmax(author));<br /> <br /> len += formatex(query_all[len], charsmax(query_all) - len, "%s (^"%s^", ^"%s^", ^"%s^", ^"%s^")", i ? "," : "", filename, name, author, version);<br /> }<br /> <br /> query = SQL_PrepareQuery(db, "%s;", query_all);<br /> <br /> if(!SQL_Execute(query))<br /> {<br /> SQL_QueryError(query, query_all, charsmax(query_all));<br /> log_amx("Error on adding plugins: %s", query_all);<br /> }<br /> <br /><br /> SQL_FreeHandle(query);<br /> <br /> SQL_FreeHandle(db);<br /> <br /> return 1;<br />}</code><hr />
</div><br />And Error giving at console is ;<br /><br /><div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">Code:</div>
<hr /><code style="margin:0px" dir="ltr" style="text-align:left"> [musti.amxx] Error on adding plugins: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"adminvote.a' at line 1</code><hr />
</div>I tried to diffrent version of MYSQL on Cpanel, it doesnt work..<br /><br />Thank you<br />Regards</div>
Wyświetl pełny artykuł
Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse

Plugins to database
Temat rozp. Adminek AMXX.PL, 11.08.2015 17:40
Brak odpowiedzi do tego tematu
Użytkownicy przeglądający ten temat: 0
0 użytkowników, 0 gości, 0 anonimowych