SA-MP Forums Archive
MySQL Error Check - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MySQL Error Check (/showthread.php?tid=152398)



MySQL Error Check - Astaroth - 04.06.2010

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


Re: MySQL Error Check - Astaroth - 08.06.2010

nobody can help me?


Re: MySQL Error Check - Aleksandar_Zivanovci - 08.06.2010

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()


Re: MySQL Error Check - Astaroth - 08.06.2010

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)


Re: MySQL Error Check - Aleksandar_Zivanovci - 08.06.2010

you dont need errno, you need mysql_ERROR()


Re: MySQL Error Check - Astaroth - 08.06.2010

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?


Re: MySQL Error Check - Aleksandar_Zivanovci - 08.06.2010

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


Re: MySQL Error Check - Aleksandar_Zivanovci - 08.06.2010

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


Re: MySQL Error Check - Astaroth - 08.06.2010

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?


Re: MySQL Error Check - Aleksandar_Zivanovci - 08.06.2010

numerical value of the error message (ID of message)