SA-MP Forums Archive
MySQL ID - 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 ID (/showthread.php?tid=621732)



MySQL ID - Micko123 - 14.11.2016

I have problem with ID. When I create org it is created with ID 0 on server and with ID 1 in DB. As soon as I edit it it changes to ID 1 but server is treating it as 0 and changes are not affected..
Any ideas?


Re: MySQL ID - iLearner - 14.11.2016

You're not fetching it as its supposed to.


Re: MySQL ID - Micko123 - 14.11.2016

PHP код:
format(stringsizeof(string), ""SERVERBLUE"ID: %d\n"SERVERBLUE" - %s -\n"SERVERBLUE"Leader: "WHITE"%s\n"SERVERBLUE"To enter press 'F' or 'ENTER'"OrgInfo[org][oID], OrgInfo[org][oName], OrgInfo[org][oLeader]);
mysql_format(g_SQLquerysizeof(query), "INSERT INTO `orgs` (`Name`, `Leader`, `ExitX`, `ExitY`, `ExitZ`, `IntX`, `IntY`, `IntZ`, `VW`, `Interior`) VALUES ('%s', '%s', %f, %f, %f, %f, %f, %f, %d, %d)"OrgInfo[org][oName], OrgInfo[org][oLeader], iXiYiZXYZvwinterior);
    
mysql_tquery(g_SQLquery"OrgsCache""i"org);
forward OrgsCache(org);
public 
OrgsCache(org)
{
    
OrgInfo[org][oID] = cache_insert_id();
    
Iter_Add(i_Orgsorg);
    return 
1;




Re: MySQL ID - iLearner - 14.11.2016

If it inserts fine into db... then you gotta show us SELECT.


Re: MySQL ID - Micko123 - 14.11.2016

I need select?? Noone told me that..


Re: MySQL ID - iLearner - 14.11.2016

Quote:
Originally Posted by Micko123
Посмотреть сообщение
PHP код:
format(stringsizeof(string), ""SERVERBLUE"ID: %d\n"SERVERBLUE" - %s -\n"SERVERBLUE"Leader: "WHITE"%s\n"SERVERBLUE"To enter press 'F' or 'ENTER'"OrgInfo[org][oID], OrgInfo[org][oName], OrgInfo[org][oLeader]);
mysql_format(g_SQLquerysizeof(query), "INSERT INTO `orgs` (`Name`, `Leader`, `ExitX`, `ExitY`, `ExitZ`, `IntX`, `IntY`, `IntZ`, `VW`, `Interior`) VALUES ('%s', '%s', %f, %f, %f, %f, %f, %f, %d, %d)"OrgInfo[org][oName], OrgInfo[org][oLeader], iXiYiZXYZvwinterior);
    
mysql_tquery(g_SQLquery"OrgsCache""i"org);
forward OrgsCache(org);
public 
OrgsCache(org)
{
    
OrgInfo[org][oID] = cache_insert_id();
    
Iter_Add(i_Orgsorg);
    return 
1;

This inserts into database the information.... but dont you think you need to fetch it later on? to use it...


Re: MySQL ID - Micko123 - 14.11.2016

Any hint to do it?? I am still new at MySQL..

And I am confused that name is not saved in DB
PHP код:
mysql_format(g_SQLquerysizeof(query), "UPDATE `orgs` SET `Name` = %s WHERE `ID` = %d LIMIT 1"orgnameOrgInfo[org][oID]);
    
mysql_tquery(g_SQLquery); 
It is not affected. It changes IG but not in DB


Re: MySQL ID - iLearner - 14.11.2016

%s = '%s'


Re: MySQL ID - Micko123 - 14.11.2016

Should I do that everytime for everything??
Or only for strings??


Re: MySQL ID - Micko123 - 14.11.2016

Okay so name is fixed. But I don't still get this with ID.. Have no idea how to do it..