#1

How do I exactly do this:


Like, I have this:

User: ID Username etc, etc... Weap1 Ammo1 Weap2 Ammo2 Weap3 Ammo 3 Weap4 AMmo 4


I want to like "Select" from "Users" and "Select" the player "Id/Username" then delete "Weapon1, AMmo1, Weap2, Ammo2, Weap2, AMmo3, Weap4, Ammo4"...Is that possible? How?
Reply
#2

I think you're missing a where in there somewhere.

You may be wanting to set them to null, I found by googling, because delete does the row, but if you want the cells done you can set them to nothing.
Reply
#3

Just save the user id somewhere like userid[playerid] after login. Now you can use update:
Update tablename set fieldname = 0 Where fieldname = var.
You Will have to format a string.
Reply
#4

You need to write a mysql query. Here's an example script. https://github.com/pBlueG/SA-MP-MySQ...stem-cache.pwn
Reply
#5

Quote:
Originally Posted by Awide
Посмотреть сообщение
You need to write a mysql query. Here's an example script. https://github.com/pBlueG/SA-MP-MySQ...stem-cache.pwn
You've taken his needle, and thrown it into a haystack... Where exactly does he look in that script, to find what you think he needs, because if you can't actually highlight it, then don't be posting up an 'example script'.

He obviously knows he has to write a query, because he started saying about that in the first post.


So literally all you've done is simply posted up the example script from the plugin itself, nothing more.
Reply
#6

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
I think you're missing a where in there somewhere.

You may be wanting to set them to null, I found by googling, because delete does the row, but if you want the cells done you can set them to nothing.
I apologize, I'll try to explain it more clearly. I am not that familiar on MySql things, and I am trying to.

I have the table "users" which contains ID,IP,Username,Etc,Etc...


I am trying to make the gamemode script to the current 'database' we have while it isn't migrated yet.

The new database we are going to migrate to have this table "Holster" with the collumns "AccountId, Slot, WeaponId, and Ammo".


Now the current database that I want this query to load from is "Users". Which have most all stats.


I want to change the query to load it from the table 'users' and select the collums 'Weap1, Weap2, Weap3, Weap4, Ammo1, Ammo2, Ammo3, and Ammo4".

I was asking if it is possible to update/insert/delete from different collumns at once? And how do I do it?


This is the one loading on the new database: http://prntscr.com/jt6pq4

I want that to load to the current, on that table and the collumns I explained earlier. I hope I explained it clearly....
Reply
#7

Good stuff, stick with the thread. Someone will no doubt see this now due to the information provided being more elaborate.

This is something MySQL works well with, just wait for someone who knows MySQL properly.

Focus on merging TO your database, and not moving to the new databases stuff, unless you're changing the gamemode entirely.
Reply
#8

Selecting data from multiple tables: https://dev.mysql.com/doc/refman/8.0/en/join.html
Updating the row if record exists otherwise insert a new row (you can avoid sending a DELETE query and then an INSERT query with this method): https://dev.mysql.com/doc/refman/8.0...duplicate.html
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)