MySql help
#1

Hi, I am using latest mysql script.

How i can store 2 data at once

example:
Код:
new query[70];

	mysql_format(g_SQL, query, sizeof query, "UPDATE `players` SET `owner` = %d,`health` = %f WHERE `id` = %d LIMIT 1", Player[playerid][Owner],Player[playerid][Health], Player[playerid][ID]);
	mysql_tquery(g_SQL, query);
i tried this code not working

but when i do single it saves
Код:
new query[70];

	mysql_format(g_SQL, query, sizeof query, "UPDATE `players` SET `owner` = %d WHERE `id` = %d LIMIT 1", Player[playerid][Owner], Player[playerid][ID]);
	mysql_tquery(g_SQL, query);
Reply
#2

PHP код:
new query[70];
    
mysql_format(g_SQLquerysizeof query"UPDATE `players` SET `owner` = %d,`health` = %d WHERE `id` = %d LIMIT 1"Player[playerid][Owner],Player[playerid][Health], Player[playerid][ID]);
    
mysql_tquery(g_SQLquery""""); 
Reply
#3

Quote:
Originally Posted by iLearner
Посмотреть сообщение
PHP код:
new query[70];
    
mysql_format(g_SQLquerysizeof query"UPDATE `players` SET `owner` = %d,`health` = %d WHERE `id` = %d LIMIT 1"Player[playerid][Owner],Player[playerid][Health], Player[playerid][ID]);
    
mysql_tquery(g_SQLquery""""); 
still not saving data :/
Reply
#4

Do you have any error in MySQL Log?
Reply
#5

Quote:
Originally Posted by Lbaker
Посмотреть сообщение
Do you have any error in MySQL Log?
no it is empty.....

u mean D:\GTA San Andreas\Server\logs\errors.log?

it is empty
Reply
#6

maybe your health is the same or you don't have health column ?
plus the lenght of your first query is 71 chars and you have 75+ with health and your string is only 70.
Reply
#7

Quote:
Originally Posted by iLearner
Посмотреть сообщение
PHP код:
new query[70];
    
mysql_format(g_SQLquerysizeof query"UPDATE `players` SET `owner` = %d,`health` = %d WHERE `id` = %d LIMIT 1"Player[playerid][Owner],Player[playerid][Health], Player[playerid][ID]);
    
mysql_tquery(g_SQLquery""""); 
Health is NOT an integer! Also mysql_tquery doesn't need the "" if those parameters are empty as they are optional. See: https://sampwiki.blast.hk/wiki/MySQL/R40#mysql_tquery

It's odd to me that there are no errors from this if it isn't saving...

Код:
new query[80];

mysql_format(g_SQL, query, sizeof query, "UPDATE `players` SET `owner` = %d,`health` = %.1f WHERE `id` = %d LIMIT 1", Player[playerid][Owner], Player[playerid][Health], Player[playerid][ID]);
mysql_tquery(g_SQL, query);
Your Player[playerid][Health] variable is set as a float when declared, right? Also are you getting the player's health and storing it to that variable prior to this query being executed?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)