Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] mysql - invalid row index '0'

 
  • 0 Vote(s) - 0 Average
Pawn mysql - invalid row index '0'
Demo
Offline

Burgershot Member
Posts: 3
Threads: 2
Joined: Dec 2019
Reputation: 0
Location: Germany
#1
2019-12-13, 07:34 PM
Hello everyone,

i created a similar mysql login/register system now like this example here: https://github.com/pBlueG/SA-MP-MySQL/bl...-cache.pwn

The only thing i changed is: i dont assign default values after registering server side. I want to get them from db, since i added it there as defaults if a new player registers an account.
How i did this is: if we assume the functions are all the same as the example above, i called 
Code:
AssignPlayerData(playerid)
in
Code:
public OnPlayerRegister(playerid)
.


Login works fine, but if trying to "AssignPlayerData" after registration i get this error for every data i want to to get.
Code:
[plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')

If im thinking right, this is because the entire query to get data is in OnPlayerConnect, and if account does not exists we have no row for that player. So do i need to do the same query again after registering the player and before "AssignPlayerData" ? Is this the right way, or is there a cleaner way?
JustMichael
Offline

Forum Manager

Posts: 189
Threads: 3
Joined: Feb 2019
Reputation: 17
Location: England
#2
2019-12-14, 12:26 AM
Show us the code for registration, else you can't really give you the right help.
Remember to always refer to J0sh as `J0sh...`

@ Networks/Servers
San Andreas Gaming Network (Owner/Founder)
San Andreas Gaming (Owner/Founder)
Grand Theft Cop's n Robber's (Owner)
Britannia Roleplay (Owner/Founder)
Alpine RP (Owner/Founder)
Aluminium Network (Maintainer)
AlphaDM (Tech Support)

# Services
Burgershot.gg (Forum Manager)
open.mp (Member)

~ Languages/Frameworks
Pawn, C, C++, C#, Javascript, Typescript, Lua, Python, Go, Rust, PHP, SQL,
Angular, React, Vue, Svelte, Laravel, Rocket
Demo
Offline

Burgershot Member
Posts: 3
Threads: 2
Joined: Dec 2019
Reputation: 0
Location: Germany
#3
2019-12-14, 09:38 AM
Check out the example i posted, it’s exactly the same
JustMichael
Offline

Forum Manager

Posts: 189
Threads: 3
Joined: Feb 2019
Reputation: 17
Location: England
#4
2019-12-14, 09:52 AM
it's quite clear what the issue is, you are trying to access the data returned from the query, when it doesn't exist.

You are either missing a check, or you are calling `cache_get_value_name_int` too early.
Remember to always refer to J0sh as `J0sh...`

@ Networks/Servers
San Andreas Gaming Network (Owner/Founder)
San Andreas Gaming (Owner/Founder)
Grand Theft Cop's n Robber's (Owner)
Britannia Roleplay (Owner/Founder)
Alpine RP (Owner/Founder)
Aluminium Network (Maintainer)
AlphaDM (Tech Support)

# Services
Burgershot.gg (Forum Manager)
open.mp (Member)

~ Languages/Frameworks
Pawn, C, C++, C#, Javascript, Typescript, Lua, Python, Go, Rust, PHP, SQL,
Angular, React, Vue, Svelte, Laravel, Rocket
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode