Raised This Month: $ Target: $400
 0% 

SQL Error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 08-05-2010 , 19:13   SQL Error
Reply With Quote #1

I'm trying to fix a friend's code, but I don't understand SQL at all. Basically no data is loading. It might be because it isn't saving too. The only error in the logs is this:

Code:
[SM] Native "SQL_FetchInt" reported: Error fetching data from field 3
What does this mean?
__________________
almcaeobtac is offline
Dravu
Senior Member
Join Date: May 2010
Old 08-06-2010 , 03:42   Re: SQL Error
Reply With Quote #2

In your SQL query, you only return 2 columns. Your coding is trying to grab a 3rd column that doesn't exist.
Dravu is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 08-06-2010 , 06:05   Re: SQL Error
Reply With Quote #3

Columns use indexes, so you start with getting from column "0"

(It's a lot easier to see what's wrong if you show what you did, aka. your query ;p)
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.

Last edited by Monkeys; 08-06-2010 at 06:44.
Monkeys is offline
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 08-06-2010 , 08:26   Re: SQL Error
Reply With Quote #4

It's difficult. It's not my code, and he doesn't want to share it. Plus, in the error logs, it doesn't even return the correct line number for the error.
__________________
almcaeobtac is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 08-06-2010 , 09:17   Re: SQL Error
Reply With Quote #5

Well, most likely it's just a wrong index used for the column.

Check the query, the "SELECT ... FROM" part. The results are arranged exactly as they are there. Each column is seperated by a comma and they start with index 0.

So this "SELECT alpha, and, omega FROM universe WHERE god = 0;"
would result in
column 0: alpha
column 1: and
column 2: omega

In his case, he probably fetched from column 3 while he meant column 2. Or column 3 isn't an int.


(Offtopic: That isn't a query I just made up, it's actually part of a project I once made )
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 08-06-2010 , 09:45   Re: SQL Error
Reply With Quote #6

What about when it's like this:

Code:
Format(buffer, sizeof(buffer),"SELECT * FROM Player WHERE STEAMID = '%s';",SteamId);
__________________
almcaeobtac is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:49.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode