![]() |
Cutom Field on Custom Page??
How do I access a users selection from a custom field on a custom page.
Currently I have tried $auinfo[field7] $userinfo[field7] which brings up nothing and $bbuserinfo[field7] which brings up my selection when I want to see their selection. Any help? Thanks |
Are you sure field 7 is the correct field number? What does your template look like? What is the query you are using to get this users info? Did you make sure to JOIN with the userfield table?
|
1) yes 7 is the correct number.
2) My template is the following. ACTIVITY HTML Code:
$stylevar[htmldoctype] HTML Code:
<tr> PHP Code:
Thanks in advance, C |
You have only queried to get the userid and username. Nowhere in your query have you grabbed the fields from the userfield table. You can't use them in your template if never grabbed them in your query. You'll need to do another JOIN to the userfield in your $getusers query in order to have them available to you.
|
I am not very familiar with mysql so could you tell me what that query would be and where I would put it please?
|
If you change your SQL query to this...
PHP Code:
|
That gave me the following database error
Quote:
|
Find:
Code:
AND p.userid = f.userid Code:
AND p.postuserid = f.userid |
New error now:-
Quote:
|
Actually. "p.userid" should be correct. Have you set a table prefix in your config.php?
|
Quote:
|
Sorry for the bump, the help has been great so far though!
|
Try this:
PHP Code:
|
HUZZAH it works, just another quick question though, how do I make a statement if a value is less than something.
So say HTML Code:
<if conditional=$auinfo[total] IS LESS THAN $auinfo[posts]> HTML Code:
<td class="alt2"> Parse error: syntax error, unexpected T_DO in /home/geekstep/public_html/includes/adminfunctions_template.php(3938) : eval()'d code on line 9 This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish. |
Less than...
PHP Code:
PHP Code:
PHP Code:
|
You should also quote the array key inside a template conditional.
PHP Code:
|
Now a new problem arises. I am trying to make a variable changeable depending on the users selection so that if their post count does not meet the requirements staff are noted.
Basically I want to make the following HTML Code:
however the code I am using in my PHP file does not display the stuff set when I add $conditional into my template here is the code PHP Code:
|
Bump
anyone please?? |
Sorry for another bump but I really need help on this I am at wits end...
|
Change...
PHP Code:
PHP Code:
Edit: To clarify, this is what you would use if you're trying to utilize this in the postbit template. |
Quote:
|
No in the php file I was trying to set a number to the variable $conditional then use the HTML code to see if the number is lessthan the required number
|
And the problem is that $conditional currently does not contain anything, right?
|
I think so, if you go to http://www.geekstep.com/activity.php?styleid=19 you will see that the column "posts required" is not showing any numbers which means that the action required field cannot function.
@Cryo :- Your suggestion did not work since it is a custom template not the postbit. |
Anymore suggestions please?
|
Sorry will have to bump again I really need this please.
|
Quote:
|
Ok here is the activity.php file.
PHP Code:
HTML Code:
$stylevar[htmldoctype] HTML Code:
<tr> |
You've evaled your ACTIVITY_bits template before you've done all the php to define the variable $conditional. You need to define $conditional before you eval the template otherwise the information isn't available to you in that template.
|
Ok I have moved the code and still nothing, here is the new activity.php file
PHP Code:
If it is easier I could do it in the template system but I don't know if that would be possible |
You can't move it there because $auinfo is not defined there. You need to move it to within the while statement. The while statement is what defines $auinfo - $auinfo = $db->fetch_array($getusers). So, after $auinfo is defined but before the template is evaled.
|
Now things have gone weired :S
Before:- http://i41.tinypic.com/2yyw67a.jpg After:- http://i40.tinypic.com/105ce8g.jpg PHP File: PHP Code:
After Screenshot:- http://i40.tinypic.com/105ce8g.jpg Here's what happens you can see from the 'before' screenshot all of the usernames are generated with their post count however in the 'after' screenshot you can see the field works but only that field works, also selecting a month from the dropdown changes that number. |
You need to have your code within the parenthesis for your while statement. You don't have it there right now which is why it's all screwed up. Basically:
PHP Code:
|
YAY that worked...kinda.
For some reason not all of the fields display properly. PHP File PHP Code:
http://i41.tinypic.com/5kg1tx.jpg |
You should make sure to set conditional to 0 before entering your series of conditions to define it otherwise it will just use the variable it was set to before. If that isn't it, time for some debugging by spitting out a bunch of stuff along the way to see what is going on.
|
1 Attachment(s)
I took your advice and went and told the PHP file that $conditional always = 0 unless otherwise stated, which worked now it's only RESELLER B & C that display 0
Here is their code PHP Code:
|
I meant you should put some new variables into your code to help you debug stuff. Like actually print out field7 on the page so you can see why it is giving you 0 instead of values for B & C. (Can you visually see a difference right before B? You have the else if on a new line. Perhaps move that to the same line as the end parenthesis.)
|
I tried moving the else if to the same line, no luck. As for your other question yes you can see the other values right before B&C and right after just B&C that don't work.
|
This is your problem:
PHP Code:
Are you using a proper editor when coding? Use one made for php (or html when you do html) and things like that will be quite obvious. I think it's a real necessity because you can't always test everything and a helpful editor will certainly point out some flaws you make before they come and get you later. |
I am using PHP designer but I guess it is technically not an error so it didn't flag it up. However:
Lynne, Dismounted and everyone else who has helped me is a star! As you can probably tell this is fixed now THANKS A BUNCH! I REALLY APPRECIATE IT! |
All times are GMT. The time now is 02:21 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|