MySQL Issues Again... - 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)
+--- Thread: MySQL Issues Again... (
/showthread.php?tid=656513)
MySQL Issues Again... -
IdonTmiss - 17.07.2018
Well I'm a newbie when it comes to MySQL and well I'm trying to transfer my Y_INI vehicles to MySQL but I got stuck here..
Errors
Код:
(1222) : error 035: argument type mismatch (argument 1)
(1223) : error 017: undefined symbol "mysql_store_result"
(1223) : error 017: undefined symbol "mysql_fetch_int"
(1223) : error 017: undefined symbol "mysql_free_result"
Code
PHP код:
#define TABLE_COS "vehs" // its not defined there in the function but on atop of the script just so you know
mysql_query("SELECT MAX(id) FROM `"TABLE_COS"`"); // - 1222
mysql_store_result(); vehnumb = mysql_fetch_int(); mysql_free_result(); // - 1223
Re: MySQL Issues Again... -
rollercaster - 17.07.2018
maybe run an older version of "mysql" or newer
can go and so
PHP код:
format(strt, sizeof(strt), "SELECT * FROM `TABLE_COS` WHERE `id` > 0");
mysql_tquery(SQL, strt, "LoadInfo", "");
public LoadInfo()
{
IDD = cache_num_rows();
for(new i = 1; i <= IDD; i++)
{
// Next your script
}
}
Re: MySQL Issues Again... -
IdonTmiss - 17.07.2018
Quote:
Originally Posted by rollercaster
you can run an older version of "mysql"
can go and so
PHP код:
format(strt, sizeof(strt), "SELECT * FROM `TABLE_COS` WHERE `id` > 0");
mysql_tquery(SQL, strt, "LoadInfo", "");
public LoadInfo()
{
IDD = cache_num_rows();
for(new i = 1; i <= IDD; i++)
{
// Next your script
}
}
|
Well I would like to continue to use this one, is there a solution for this?
Re: MySQL Issues Again... -
rollercaster - 17.07.2018
what do you want to do exactly?
Re: MySQL Issues Again... -
IdonTmiss - 17.07.2018
Quote:
Originally Posted by rollercaster
what do you want to do exactly?
|
I want to count all the vehicles that get created, or loaded whatever
Re: MySQL Issues Again... -
Florin48 - 17.07.2018
PHP код:
format(strt, sizeof(strt), "SELECT * FROM `TABLE_COS` WHERE `id` > 0");
mysql_tquery(SQL, strt, "LoadInfo", "");
public LoadInfo()
{
new cars = 0;
IDD = cache_num_rows();
for(new i = 1; i <= IDD; i++)
{
cars++;
// Next your script
}
printf("Vehicles Created: %d", cars);
}
something like.
Re: MySQL Issues Again... -
IdonTmiss - 17.07.2018
Fixed
Re: MySQL Issues Again... -
Calisthenics - 17.07.2018
Quote:
Originally Posted by Florin48
PHP код:
format(strt, sizeof(strt), "SELECT * FROM `TABLE_COS` WHERE `id` > 0");
mysql_tquery(SQL, strt, "LoadInfo", "");
public LoadInfo()
{
new cars = 0;
IDD = cache_num_rows();
for(new i = 1; i <= IDD; i++)
{
cars++;
// Next your script
}
printf("Vehicles Created: %d", cars);
}
something like.
|
IDD would be enough, the purpose of the loop is completely pointless. Even then, there is a better way.
pawn Код:
SELECT COUNT(*) FROM table_name
returns 1 row and is retrieved as:
pawn Код:
cache_get_value_int(0, 0, total_vehicles);
Re: MySQL Issues Again... -
GTLS - 18.07.2018
you can just Select * and use number of rows affected to count total rows.