Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: KAKAN on Mar 04, 2016, 06:24 PM

Title: mysql_info: what is it?
Post by: KAKAN on Mar 04, 2016, 06:24 PM
Well, I was updating the wiki, so I choose to update the MySQL functions first. I edited some, then came to the mysql_info function, I connected to the database and tried doing this:
print( mysql_info( handler ) );It gave me null.
Then I tried searching it in the MySQL website. Got this:
http://dev.mysql.com/doc/refman/5.0/en/mysql-info.html
So, after reading that, I came back to the script, did some queries and then tried the mysql_info, but it still gave me null. What am I doing wrong? How can I fix that?
Title: Re: mysql_info: what is it?
Post by: KAKAN on Mar 04, 2016, 07:19 PM
Any help? pl0x
Title: Re: mysql_info: what is it?
Post by: MacTavish on Mar 04, 2016, 07:28 PM
not sure but this info might help you http://www.w3schools.com/php/func_mysqli_info.asp
Title: Re: mysql_info: what is it?
Post by: Coolkid on Mar 04, 2016, 07:31 PM
R u updating wiki or this is for your server
Title: Re: mysql_info: what is it?
Post by: KAKAN on Mar 04, 2016, 07:33 PM
Quote from: Coolkid on Mar 04, 2016, 07:31 PMR u updating wiki or this is for your server
Updating wiki, and as well, it would help me with my server.
And also, this is for helping, not for asking questions like that

@Kusanagi I also gave a link to the official MySQL webpage for that function, and tried the same way and followed your link too, still then, it returns null
Title: Re: mysql_info: what is it?
Post by: Thijn on Mar 04, 2016, 08:21 PM
Works fine here:
[SCRIPT]  Rows matched: 1  Changed: 1  Warnings: 0
Doing the query twice, which means the row is already changed returns
[SCRIPT]  Rows matched: 1  Changed: 0  Warnings: 0

Just make sure you actually do the queries the manual says:
QuoteINSERT INTO ... SELECT ...

String format: Records: 100 Duplicates: 0 Warnings: 0

INSERT INTO ... VALUES (...),(...),(...)...

String format: Records: 3 Duplicates: 0 Warnings: 0

LOAD DATA INFILE ...

String format: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0

ALTER TABLE

String format: Records: 3 Duplicates: 0 Warnings: 0

UPDATE

function onScriptLoad( )
{
local conn = mysql_connect("localhost", "test", "test", "test");
if ( conn ) {
mysql_query(conn, "UPDATE benchmark SET testFloat = 123.45 WHERE testInt = 0");
print( mysql_info(conn) );
}
}
Title: Re: mysql_info: what is it?
Post by: KAKAN on Mar 05, 2016, 08:10 AM
Quote from: Thijn on Mar 04, 2016, 08:21 PMWorks fine here:
[SCRIPT]  Rows matched: 1  Changed: 1  Warnings: 0
Doing the query twice, which means the row is already changed returns
[SCRIPT]  Rows matched: 1  Changed: 0  Warnings: 0

Just make sure you actually do the queries the manual says:
QuoteINSERT INTO ... SELECT ...

String format: Records: 100 Duplicates: 0 Warnings: 0

INSERT INTO ... VALUES (...),(...),(...)...

String format: Records: 3 Duplicates: 0 Warnings: 0

LOAD DATA INFILE ...

String format: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0

ALTER TABLE

String format: Records: 3 Duplicates: 0 Warnings: 0

UPDATE

function onScriptLoad( )
{
local conn = mysql_connect("localhost", "test", "test", "test");
if ( conn ) {
mysql_query(conn, "UPDATE benchmark SET testFloat = 123.45 WHERE testInt = 0");
print( mysql_info(conn) );
}
}
I tried this:
function onScriptLoad(){
local conn = mysql_connect("localhost","test","test","vcmp");
if( !conn ) return;
mysql_query(conn,format("INSERT INTO Bans(name,uid,ip) VALUES('%s','%s','%s')","KAKAN","something","127.0.0.1" ) );
print( mysql_info( conn ) );
}
Giving the result as null
Title: Re: mysql_info: what is it?
Post by: Stormeus on Mar 09, 2016, 06:49 AM
@KAKAN Read the MySQL documentation (http://dev.mysql.com/doc/refman/5.0/en/mysql-info.html) more closely.
Quotemysql_info() returns a non-NULL value for INSERT ... VALUES only for the multiple-row form of the statement (that is, only if multiple value lists are specified).