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: 50730
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: debug SQL query

Post by Brf » Tue Jun 24, 2008 2:42 am

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 » Tue Jun 24, 2008 6:09 am

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: 50730
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: debug SQL query

Post by Brf » Tue Jun 24, 2008 11:41 am

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 » Tue Jun 24, 2008 4:08 pm

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
Registered User
Posts: 11864
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano - Frankfurt
Name: Marco
Contact:

Re: debug SQL query

Post by 3Di » Tue Jun 24, 2008 4:10 pm

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.
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
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 » Thu Jun 26, 2008 4:23 am

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: 50730
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: debug SQL query

Post by Brf » Thu Jun 26, 2008 4:28 am

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 » Thu Jun 26, 2008 4:43 am

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

Post Reply

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

Who is online

Users browsing this forum: No registered users and 5 guests