SA-MP Forums Archive
[SQL] Says "field not found" when it exists - 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: [SQL] Says "field not found" when it exists (/showthread.php?tid=530215)



[SQL] Says "field not found" when it exists - Amator - 06.08.2014

Hi.

I spent a long time these days to work and try to learn a few things about MySQL. Thanks to the nice tutorials around here, it's been a good time until I wanted to go further.

So, I don't know why, but one of my 'cache_get_field_content' returns 'field not found' in the logs, and of course, I also have no value, whereas the field does exist.

pawn Код:
[02:51:22] [DEBUG] cache_get_field_content - row: 0, field_name: "IP", connection: 1, max_len: 16
[02:51:22] [WARNING] CMySQLResult::GetRowDataByName - field not found ("IP")
pawn Код:
cache_get_field_content(0, "IP", DBIP0, mysql, 16);
Maybe I missed something, but I whish you could tell me what I don't understand, thanks.


Re: [SQL] Says "field not found" when it exists - Blademaster680 - 06.08.2014

Is there something in the field? or is it blank?


Re: [SQL] Says "field not found" when it exists - dirigent00 - 06.08.2014

Try this:
Код:
cache_get_field_content(0, "IP", DBIP0, 16);



Re : [SQL] Says "field not found" when it exists - Amator - 06.08.2014

Quote:
Originally Posted by Blademaster680
Посмотреть сообщение
Is there something in the field? or is it blank?
Actually, there is one player registered in the database, me with 127.0.0.1, and the DB looks completly okay.

Quote:
Originally Posted by dirigent00
Посмотреть сообщение
Try this:
Код:
cache_get_field_content(0, "IP", DBIP0, 16);
Result:

[13:12:21] [ERROR] "cache_get_field_content" - invalid connection handle (ID = 16)

And with:

pawn Код:
cache_get_field_content(0, "IP", DBIP0);
Sends field not found.


Re: [SQL] Says "field not found" when it exists - Vince - 06.08.2014

Show the query.


Re : [SQL] Says "field not found" when it exists - Amator - 06.08.2014

This one?

pawn Код:
mysql_format(mysql, query, sizeof(query),"SELECT `Password`, `ID` FROM `playersdata` WHERE `Username` = '%s' LIMIT 1", pName[playerid]);

mysql_tquery(mysql, query, "UserAccount", "i", playerid);



Re: [SQL] Says "field not found" when it exists - Vince - 06.08.2014

Yes, well how do you expect to fetch the IP if you're not even selecting it? I'll take you know what that keyword is for?


Re : [SQL] Says "field not found" when it exists - Amator - 06.08.2014

Okay, that's something I didn't know, it works perfectly now, of course, I seriously need to work more on it.

Thank you!