AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Work with Mysql, the request to help to understand (https://forums.alliedmods.net/showthread.php?t=89513)

asdcoolpix 04-07-2009 12:10

Work with Mysql, the request to help to understand
 
Kind time your help for a spelling of some of mine задумок is necessary To me, but for this purpose it is necessary for me to receive some skills on operation with a database. I hope you will help))

Some primitive tasks which it would be necessary to solve)

development Conditions:

1. Database MySql:
db_name = "testname"
db_user = "testuser"
db_pass = "testpass"
the table test a table design:
[IMG]http://img530.**************/img530/9821/testtable.jpg[/IMG]
2. server with AMXX

The task to write plug-ins for operation with this base:
1. The plug-in which would select from a DB a value x And printed in server console a value
2. The plug-in which would select from a DB a value x and a variable y would bring them in the array, and then output in the console of a server value of variables.
3. The plug-in which would select from a DB a value x and a variable y added two variables and created new string of record in the table with variable = cAnd value value in the form of their sum.
4. The plug-in which would refresh value of new string c. If c = 5 then replace on 0

Well and what a thread a plug-in for record removal in the table in general.






Excuse me for my English I from Russia :)

asdcoolpix 04-07-2009 15:13

Re: Work with Mysql, the request to help to understand
 
please help me

asdcoolpix 04-08-2009 08:28

Re: Work with Mysql, the request to help to understand
 
up

asdcoolpix 04-08-2009 16:17

Re: Work with Mysql, the request to help to understand
 
up2

asdcoolpix 04-09-2009 09:23

HELP ME PLEASE !!!!
 
I have already started to understand itself. But has faced a problem. I try to output contents of a cell of a database in the console of a server. But anything it is impossible to me here a code part which does not work:

DB

[IMG]http://img4.**************/img4/2429/97666737.jpg[/IMG]

PHP Code:

#define H_TABLE_UP "hmk_update"
#define H_TABLE_UPQ "huds" 

...............
.............
....
PHP Code:

public update(){
    if (
dbc == SQL_FAILED) {
        
server_print("[HOMKA-update] not connect with db")
                            }
    else {
        
server_print("[HOMKA-update] connect with db - OK !");
        
result dbi_query(dbc,"SELECT value FROM `%s` WHERE type = `%s`",H_TABLE_UP,H_TABLE_UPQ);
        new 
pr[32]
        
//SQL_ReadResult(result, 0, pr, 31)
        
dbi_result(result"value"pr31)  //line 96
        
server_print("resultat: %s"pr)
       
    }



It writes a server to the console:
Code:


[HOMKA-update] connect with db - OK !

L 04/09/2009 - 17:35:51: [MySQL] Invalid DBI result handle -1
L 04/09/2009 - 17:35:51: [AMXX] Displaying debug trace (plugin "tak.amxx")
L 04/09/2009 - 17:35:51: [AMXX] Run time error 10: native error (native "dbi_result")
L 04/09/2009 - 17:35:51: [AMXX]    [0] tak.sma::update (line 96)

:arrow:Help me to output result in the server console

asdcoolpix 04-09-2009 11:13

Re: Work with Mysql, the request to help to understand
 
please help me :cry:

DaxProxy 07-12-2009 05:29

Re: Work with Mysql, the request to help to understand
 
Use sqlX instead of DBI, DBI cant give any output youre asking for.


All times are GMT -4. The time now is 02:20.

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