The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mySQL problem - db.row
Author Message
Eledrianek
Apprentice
*

Posts: 21
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Aug 2014
Reputation: 0



Post: #1
mySQL problem - db.row
Hi,
can anyone help me with little mysql problem?

This works:
Code:
DB.QUERY "SELECT COUNT(*) FROM kelevar_quests_stats"
        local.kolik=<db.row.0>
        FOR <local.kolik>
        DB.QUERY "SELECT prijato FROM kelevar_quests_stats WHERE ID='<dlocal._for>'"
        local.prijato=<db.row.0>
        DB.QUERY "SELECT splneno FROM kelevar_quests_stats WHERE ID='<dlocal._for>'"
        local.splneno=<db.row.0>
        DB.QUERY "SELECT preruseno FROM kelevar_quests_stats WHERE ID='<dlocal._for>'"
        local.preruseno=<db.row.0>
        DB.QUERY "SELECT ID_questu FROM kelevar_quests_stats WHERE ID='<dlocal._for>'"
        DB.QUERY "SELECT * FROM kelevar_quests_stats WHERE id='<dlocal._for>'"

But this one not (it result to debug and show only db.row.1)
Code:
        local.name=<DEF.QUEST_<argn1>_NAMELOCALIZED>
        DB.QUERY "SELECT COUNT(*) FROM kelevar_quests_stats"
        local.kolik=<db.row.0>
        FOR <local.kolik>
        DB.QUERY "SELECT * FROM kelevar_quests_stats WHERE id='<dlocal._for>'"
        dtext 95 <eval 60+(<dlocal._for>*20)> 88 <def.quest_<db.row.1>_namelocalized>
        dtext 370 <eval 60+(<dlocal._for>*20)> 44 <db.row.2>
        dtext 430 <eval 60+(<dlocal._for>*20)> 44 <db.row.3>
        dtext 490 <eval 60+(<dlocal._for>*20)> 44 <db.row.4>
        local.x +=1
        endfor

This shorter code results to this:
Code:
04:57:DEBUG:__ thread (3048) __ |  # | _____ function _____________ | ticks passed from previous function start ______
04:57:DEBUG:>>         3048     |  0 | NetworkManager::processAllInput | +0
04:57:DEBUG:>>         3048     |  1 |   NetworkInput::processInput | +0
04:57:DEBUG:>>         3048     |  2 |    NetworkInput::processData | +0
04:57:DEBUG:>>         3048     |  3 |    NetworkInput::processData | +0
04:57:DEBUG:>>         3048     |  4 | NetworkInput::processGameClientData | +0
04:57:DEBUG:>>         3048     |  5 | PacketGumpDialogRet::onReceive | +0
04:57:DEBUG:>>         3048     |  6 |     CClient::Dialog_OnButton | +0
04:57:DEBUG:>>         3048     |  7 |  CScriptObj::OnTriggerRunVal | +0
04:57:DEBUG:>>         3048     |  8 |     CScriptObj::OnTriggerRun | +0
04:57:DEBUG:>>         3048     |  9 |                CChar::r_Verb | +0
04:57:DEBUG:>>         3048     | 10 |             CObjBase::r_Verb | +0
04:57:DEBUG:>>         3048     | 11 |        CClient::Dialog_Setup | +0
04:57:DEBUG:>>         3048     | 12 |        CDialogDef::GumpSetup | +0
04:57:DEBUG:>>         3048     | 13 |  CScriptObj::OnTriggerRunVal | +0
04:57:DEBUG:>>         3048     | 14 |     CScriptObj::OnTriggerRun | +0
04:57:DEBUG:>>         3048     | 15 |     CScriptObj::OnTriggerRun | +0
04:57:DEBUG:>>         3048     | 16 | CScriptObj::OnTriggerForLoop | +16
04:57:DEBUG:>>         3048     | 17 |     CScriptObj::OnTriggerRun | +1719
04:57:DEBUG:>>         3048     | 18 |           CDialogDef::r_Verb | +0
04:57:DEBUG:>>         3048     | 19 |                CChar::r_Verb | +0
04:57:DEBUG:>>         3048     | 20 |             CObjBase::r_Verb | +47
04:57:DEBUG:>>         3048     | 21 |           CScriptObj::r_Verb | +0 <-- exception catch point (below is guessed and could be incorrect!)
04:57:DEBUG:>>         3048     | 22 |                CGFile::Close | +0
04:57:DEBUG:command 'DB.QUERY' args '"SELECT * FROM kelevar_quests_stats WHERE id='20'' [231AF63C]

How this thing works? Is it possible to extract all information from the mySQL table? Thanks for any help...
(This post was last modified: 09-11-2014 01:00 PM by Eledrianek.)
09-11-2014 12:57 PM
Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #2
RE: mySQL problem - db.row
Hi!

Could you give more information?
Like a printscreen of your table and what data you want to get from it.

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
09-11-2014 02:36 PM
Find all posts by this user Like Post Quote this message in a reply
Eledrianek
Apprentice
*

Posts: 21
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Aug 2014
Reputation: 0



Post: #3
RE: mySQL problem - db.row
This is the screen of my table kelevar_quests_stats. MySQL access and reading column just one by one (im able to access to the data from "ID_questu" "prijato" etc but not all in one QUERY.

Is there a way how sphere could read whole this table and use its informations in the script?

Or I must use scp like this, with multiple QUERIES:
Code:
//DB.QUERY "SELECT prijato FROM kelevar_quests_stats WHERE ID='<dlocal._for>'"
        //local.prijato=<db.row.0>
        //DB.QUERY "SELECT splneno FROM kelevar_quests_stats WHERE ID='<dlocal._for>'"
        //local.splneno=<db.row.0>
        //DB.QUERY "SELECT preruseno FROM kelevar_quests_stats WHERE ID='<dlocal._for>'"
        //local.preruseno=<db.row.0>
        //DB.QUERY "SELECT ID_questu FROM kelevar_quests_stats WHERE ID='<dlocal._for>'"

[Image: L9Y0f.jpg]
09-11-2014 09:00 PM
Find all posts by this user Like Post Quote this message in a reply
Eledrianek
Apprentice
*

Posts: 21
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Aug 2014
Reputation: 0



Post: #4
RE: mySQL problem - db.row
Ok.... I rework this to show data in the web, so I dont need this anymore. But answer should be interesting for someone else.

I have another questions related to this - is there any way how I can send variables to the mySQL with unicode? I have huge problem with symbols like that - ěščřžřžýáýéíá - which we use normaly in our language. I cant find a way... Shock(
09-12-2014 12:19 AM
Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #5
RE: mySQL problem - db.row
To get all columns, use this:

DB.QUERY SELECT * FROM TABLE_NAME WHERE ID_questu='x'

It will return whole data found with ID_questu='x'
The number of rows found is <DB.ROW.NUMROWS>
To access a specific column: <DB.ROW."RowNumber"."ColumnName">
Example: <DB.ROW.0.PRIJATO> will return the value on column 'prijato' of the line '0'

Not sure about the unicode thing, but you need to change some settings on database.
You can find a lot of help in google.

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
09-12-2014 12:53 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 3 Guest(s)