debug SQL query

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53379
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: debug SQL query

Post by Brf »

How are you checking "user_itc_status" ?
The value in the database is not the same as the value of a program variable.
worker201
Registered User
Posts: 17
Joined: Fri Apr 11, 2008 3:49 am

Re: debug SQL query

Post by worker201 »

My ineptness comes from poorly mimicking code found in other parts of phpBB. In the UPDATE queries I studied, values were never directly passed -- variables were set and then their values were passed. The line from this part of the code that reads:

Code: Select all

$user_itc_status = 1;
was part of my attempt to follow this pattern - it doesn't actually need to be there. I was planning to use that variable in place of the integer 1 in the SQL query. user_itc_status in the table is a value set to either 1 or 0. Its default value is 0, and the conditions outlined here are the only circumstances in which it will be modified to 1.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53379
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: debug SQL query

Post by Brf »

That value would be found in $user->data['user_itc_status'], but since you are updating the user table, you would also have to update $user->data['user_itc_status'] if you want to check its value later.
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: debug SQL query

Post by drathbun »

Brf wrote:That value would be found in $user->data['user_itc_status']
Oops, that's phpBB3 syntax. phpBB2 syntax is simply $userdata['user_itc_status']. :-P
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: debug SQL query

Post by 3Di »

worker201 wrote: In the UPDATE queries I studied, values were never directly passed -- variables were set and then their values were passed. The line from this part of the code that reads:

Code: Select all

$user_itc_status = 1;
was part of my attempt to follow this pattern - it doesn't actually need to be there. I was planning to use that variable in place of the integer 1 in the SQL query. user_itc_status in the table is a value set to either 1 or 0. Its default value is 0, and the conditions outlined here are the only circumstances in which it will be modified to 1.
Let's say the correct behaviour/codeing of phpbb2 it is not like the one you are describing, it is correct though to store a flag into the DB, say the config_table.. then read the flag that's passed through the phpbb2/(or your own) core code till reaches the exact location where to be used for some related purposes. I didn't fully read this topic though.

Regards.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
worker201
Registered User
Posts: 17
Joined: Fri Apr 11, 2008 3:49 am

Re: debug SQL query

Post by worker201 »

drathbun wrote:
Brf wrote:That value would be found in $user->data['user_itc_status']
Oops, that's phpBB3 syntax. phpBB2 syntax is simply $userdata['user_itc_status']. :-P
I thought $userdata referred to the currently logged in user. This code is called by a registered user but affects another registered user. My understanding is that setting $userdata['user_itc_status'] would affect the currently logged in user. Please correct me if I am wrong.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53379
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: debug SQL query

Post by Brf »

That is correct.
You would have to store it in a variable yourself if you wanted to check its value later.
worker201
Registered User
Posts: 17
Joined: Fri Apr 11, 2008 3:49 am

Re: debug SQL query

Post by worker201 »

Consider this issue solved, thanks everyone for your input and guidance.
Post Reply

Return to “[2.0.x] MOD Writers Discussion”