MySQL Error Check
#1

Hi, I'm using the G-sTyLeZzZ MySQL Plugin and i'm getting this issue:

If I try to check the success of a query operation, I get an invalid error number.

Look, in my script I have this:

Код:
mysql_query(query);
	printf("ERROR: %d",mysql_errno());
The query finish OK:

Код:
[00:07:54] CMySQLHandler::Query(SELECT id FROM usuarios WHERE username='Astaroth') - Successfully executed.

[00:07:54] >> mysql_errno( Connection handle: 1 )
But in the server console I get:

Код:
ERROR: 11862392
Instead of "ZERO" value (for suceeded querys)

What happens?

P.S: Sorry for my poor english.

Thanks
Reply
#2

nobody can help me?
Reply
#3

Quote:
Originally Posted by Astaroth
Hi, I'm using the G-sTyLeZzZ MySQL Plugin and i'm getting this issue:

If I try to check the success of a query operation, I get an invalid error number.

Look, in my script I have this:

Код:
mysql_query(query);
	printf("ERROR: %d",mysql_errno());
The query finish OK:

Код:
[00:07:54] CMySQLHandler::Query(SELECT id FROM usuarios WHERE username='Astaroth') - Successfully executed.

[00:07:54] >> mysql_errno( Connection handle: 1 )
But in the server console I get:

Код:
ERROR: 11862392
Instead of "ZERO" value (for suceeded querys)

What happens?

P.S: Sorry for my poor english.

Thanks
there is no way to print error like with PHP, because there is no function mysql_error()
Reply
#4

Quote:
Originally Posted by Aleksandar_Zivanovci
there is no way to print error like with PHP, because there is no function mysql_error()
In the G-sTyLeZzZ's MySQL Plugin (http://forum.sa-mp.com/index.php?topic=79352.0) THERE IS a mysql_errno() function.

In the MySQL API C Documentation (in which the plugin was based on) say that when no error ocurred, the mysql_errno() function returns ZERO. (http://dev.mysql.com/doc/refman/5.0/en/mysql-errno.html)
Reply
#5

you dont need errno, you need mysql_ERROR()
Reply
#6

Quote:
Originally Posted by Aleksandar_Zivanovci
you dont need errno, you need mysql_ERROR()
The plugin have "errorno". what do that function if cannot be use for detect an error on a query execution?
Reply
#7

mysql_errno — Returns the numerical value of the error message from previous MySQL operation
Reply
#8

and mysql_error Returns the text of the error message from previous MySQL operation
Reply
#9

Quote:
Originally Posted by Aleksandar_Zivanovci
mysql_errno — Returns the numerical value of the error message from previous MySQL operation
Ok, when the previous MySQL operation end successful, what returns?
Reply
#10

numerical value of the error message (ID of message)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)