![]() |
Newbie question..
I'm rather embarrased to post this, but hey - we all have to start somewhere..
I've tried to integrate some options in to the admincp, but in the code where I want them to take effect, it causes a MySQL error.. I dare say there are certain rules to comply with in SQL queries - I'm still learning things.. Anyway, one of the created variables are $vboptions['journals_recentdisplaylimit'] In this example, I wanted to apply it to this piece of code: Code:
$journal_recent_entries = $DB_site->query("SELECT j.enabled, u.username, e.journalid, e.title, e.entry, e.mood, e.np, e.timestamp, e.userid Code:
$journal_recent_entries = $DB_site->query("SELECT j.enabled, u.username, e.journalid, e.title, e.entry, e.mood, e.np, e.timestamp, e.userid Quote:
I figured I'd try and get around this by applying it to a second variable, so tried this: Code:
$recentdisplaylimit = $vboptions['journals_recentdisplaylimit']; Code:
$journal_recent_entries = $DB_site->query("SELECT j.enabled, u.username, e.journalid, e.title, e.entry, e.mood, e.np, e.timestamp, e.userid Quote:
Oh - and if the SQL query is messy, don't blame me.. I didn't write it.! |
$recentdisplaylimit isn't being set so that's why you are receiving a SQL error. You need to make sure that variable has a value.
|
$recentdisplaylimit = $vboptions['journals_recentdisplaylimit'];
If $vboptions['journals_recentdisplaylimit'] is set as 10 in the admin cp, doesn't $recentdisplaylimit become 10? |
According to the query it's not. I'm not sure why it would do that.
|
Bleh.. How annoying.. :tired:
|
What do you get when you echo $vboptions['journals_recentdisplaylimit'] ?
|
Sadly, nothing.. Nothing get's printed.
I used echo $vboptions['journals_recentdisplaylimit']; |
the t-string error could've been fixed by doing this
PHP Code:
|
Quote:
However, I wasn't sure if that would work in the first place or not. Now I know it would.. =) $vboptions['journals_recentdisplaylimit'] doesn't seem to be pulling the value from the database when used in the journal.php file though.. Is there something else I need to add to get it to work? |
Quote:
|
either that or try using normal brackets instead of square brackets for the .php files.
actually i think i'm talking ++++. |
1 Attachment(s)
Zachery gave me the attached file to try..
It appears that the variables aren't being parsed, instead of the values being echo'd, the variables themselves are.. It's a very strange problem, anyone know the fix? Also attached a screeny. Yes, the variables exist and have been set in the admincp.. ;) |
Regarding the test file you made in the above post, strings in single quotes do not get parsed, strings in double quotes do however
So Code:
$moo = 'baa'; Code:
$moo If so, make sure you add "global $vboptions;" If not, add "var_dump($vboptions);" in front of the query and see what the output is. |
BINGO!
Thanks Danny, works a treat.! :glasses: |
All times are GMT. The time now is 03:38 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:
|