Skocz do zawartości

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.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

Plugins to database


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Adminek AMXX.PL

    Admin :)

  • Bot

Reputacja: 156
Profesjonalista

  • Postów:7 492
  • Lokalizacja:AMXX.PL
Offline

Napisano 11.08.2015 17:40

<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 &lt;amxmodx&gt;<br />#include &lt;sqlx&gt;<br /><br />#define SQL_HOST &quot;localhost&quot;<br />#define SQL_USER &quot;*****&quot;<br />#define SQL_PASS &quot;*****&quot;<br />#define SQL_DB &quot;*******&quot;<br />public plugin_init()<br />{<br />&nbsp; &nbsp; register_plugin(&quot;Plugin List to SQL&quot;, &quot;0.0.1&quot;, &quot;Exolent&quot;);<br />&nbsp; &nbsp; register_concmd(&quot;amx_musti&quot;, &quot;musti&quot;, ADMIN_CFG, &quot;asdas&quot;)<br />}<br /><br />public plugin_cfg()<br />{<br />&nbsp; &nbsp; new Handle:tuple = SQL_MakeDbTuple(SQL_HOST, SQL_USER, SQL_PASS, SQL_DB);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; if(tuple == Empty_Handle) return log_amx(&quot;Failed to make SQL tuple&quot;);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; new errcode, error[128];<br />&nbsp; &nbsp; new Handle:db = SQL_Connect(tuple, errcode, error, charsmax(error));<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; if(db == Empty_Handle) return log_amx(&quot;Failed connecting to db (%d): %s&quot;, errcode, error);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; new Handle:query = SQL_PrepareQuery(db,<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;CREATE TABLE IF NOT EXISTS plugin_list <br />&nbsp; &nbsp; &nbsp; &nbsp; (filename VARCHAR(64) NOT NULL, <br />&nbsp; &nbsp; &nbsp; &nbsp; name VARCHAR(64) NOT NULL, <br />&nbsp; &nbsp; &nbsp; &nbsp; author VARCHAR(64) NOT NULL, <br />&nbsp; &nbsp; &nbsp; &nbsp; version VARCHAR(32) NOT NULL);&quot;);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; if(!SQL_Execute(query))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; SQL_QueryError(query, error, charsmax(error));<br />&nbsp; &nbsp; &nbsp; &nbsp; log_amx(&quot;Error on create table: %s&quot;, error);<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; SQL_FreeHandle(query);<br /><br />&nbsp; &nbsp; query = SQL_PrepareQuery(db, &quot;DELETE FROM plugin_list;&quot;);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; if(!SQL_Execute(query))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; SQL_QueryError(query, error, charsmax(error));<br />&nbsp; &nbsp; &nbsp; &nbsp; log_amx(&quot;Error on emptying table: %s&quot;, error);<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; SQL_FreeHandle(query);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; new filename[64], name[64], author[64], version[32];<br />&nbsp; &nbsp; new pluginsnum = get_pluginsnum();<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; static query_all[1024];<br />&nbsp; &nbsp; new len = copy(query_all, charsmax(query_all),<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;INSERT INTO plugin_list <br />&nbsp; &nbsp; &nbsp; &nbsp; (filename, name, author, version) <br />&nbsp; &nbsp; &nbsp; &nbsp; VALUES&quot;);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; for(new i = 0; i &lt; pluginsnum; i++)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; get_plugin(i, filename, charsmax(filename), name, charsmax(name), version, charsmax(version), author, charsmax(author));<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; len += formatex(query_all[len], charsmax(query_all) - len, &quot;%s (^&quot;%s^&quot;, ^&quot;%s^&quot;, ^&quot;%s^&quot;, ^&quot;%s^&quot;)&quot;, i ? &quot;,&quot; : &quot;&quot;, filename, name, author, version);<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; query = SQL_PrepareQuery(db, &quot;%s;&quot;, query_all);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; if(!SQL_Execute(query))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; SQL_QueryError(query, query_all, charsmax(query_all));<br />&nbsp; &nbsp; &nbsp; &nbsp; log_amx(&quot;Error on adding plugins: %s&quot;, query_all);<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; SQL_FreeHandle(query);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; SQL_FreeHandle(db);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; return 1;<br />}&nbsp; <br /><br />public musti()<br />{<br />&nbsp; &nbsp; new Handle:tuple = SQL_MakeDbTuple(SQL_HOST, SQL_USER, SQL_PASS, SQL_DB);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; if(tuple == Empty_Handle) return log_amx(&quot;Failed to make SQL tuple&quot;);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; new errcode, error[128];<br />&nbsp; &nbsp; new Handle:db = SQL_Connect(tuple, errcode, error, charsmax(error));<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; if(db == Empty_Handle) return log_amx(&quot;Failed connecting to db (%d): %s&quot;, errcode, error);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; new Handle:query = SQL_PrepareQuery(db,<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;CREATE TABLE IF NOT EXISTS plugin_list <br />&nbsp; &nbsp; &nbsp; &nbsp; (filename VARCHAR(64) NOT NULL, <br />&nbsp; &nbsp; &nbsp; &nbsp; name VARCHAR(64) NOT NULL, <br />&nbsp; &nbsp; &nbsp; &nbsp; author VARCHAR(64) NOT NULL, <br />&nbsp; &nbsp; &nbsp; &nbsp; version VARCHAR(32) NOT NULL);&quot;);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; if(!SQL_Execute(query))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; SQL_QueryError(query, error, charsmax(error));<br />&nbsp; &nbsp; &nbsp; &nbsp; log_amx(&quot;Error on create table: %s&quot;, error);<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; SQL_FreeHandle(query);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; query = SQL_PrepareQuery(db, &quot;DELETE FROM plugin_list;&quot;);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; if(!SQL_Execute(query))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; SQL_QueryError(query, error, charsmax(error));<br />&nbsp; &nbsp; &nbsp; &nbsp; log_amx(&quot;Error on emptying table: %s&quot;, error);<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; SQL_FreeHandle(query);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; new filename[64], name[64], author[64], version[32];<br />&nbsp; &nbsp; new pluginsnum = get_pluginsnum();<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; static query_all[1024];<br />&nbsp; &nbsp; new len = copy(query_all, charsmax(query_all),<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;INSERT INTO plugin_list <br />&nbsp; &nbsp; &nbsp; &nbsp; (filename, name, author, version) <br />&nbsp; &nbsp; &nbsp; &nbsp; VALUES&quot;);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; for(new i = 0; i &lt; pluginsnum; i++)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; get_plugin(i, filename, charsmax(filename), name, charsmax(name), version, charsmax(version), author, charsmax(author));<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; len += formatex(query_all[len], charsmax(query_all) - len, &quot;%s (^&quot;%s^&quot;, ^&quot;%s^&quot;, ^&quot;%s^&quot;, ^&quot;%s^&quot;)&quot;, i ? &quot;,&quot; : &quot;&quot;, filename, name, author, version);<br />&nbsp;}<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; query = SQL_PrepareQuery(db, &quot;%s;&quot;, query_all);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; if(!SQL_Execute(query))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; SQL_QueryError(query, query_all, charsmax(query_all));<br />&nbsp; &nbsp; &nbsp; &nbsp; log_amx(&quot;Error on adding plugins: %s&quot;, query_all);<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; <br /><br />&nbsp; &nbsp; SQL_FreeHandle(query);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; SQL_FreeHandle(db);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; 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 '&quot;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ł




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych