The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
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 FROM journal_entry e, journal j, user u WHERE e.userid = u.userid AND e.userid = j.userid AND e.private = 0 AND j.enabled = 1 ORDER BY e.timestamp DESC LIMIT 30"); 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 FROM journal_entry e, journal j, user u WHERE e.userid = u.userid AND e.userid = j.userid AND e.private = 0 AND j.enabled = 1 ORDER BY e.timestamp DESC LIMIT $vboptions['journals_recentdisplaylimit']"); 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 FROM journal_entry e, journal j, user u WHERE e.userid = u.userid AND e.userid = j.userid AND e.private = 0 AND j.enabled = 1 ORDER BY e.timestamp DESC LIMIT $recentdisplaylimit"); Quote:
Oh - and if the SQL query is messy, don't blame me.. I didn't write it.! |
#2
|
||||
|
||||
$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.
|
#3
|
||||
|
||||
$recentdisplaylimit = $vboptions['journals_recentdisplaylimit'];
If $vboptions['journals_recentdisplaylimit'] is set as 10 in the admin cp, doesn't $recentdisplaylimit become 10? |
#4
|
||||
|
||||
According to the query it's not. I'm not sure why it would do that.
|
#5
|
||||
|
||||
Bleh.. How annoying.. :tired:
|
#6
|
||||
|
||||
What do you get when you echo $vboptions['journals_recentdisplaylimit'] ?
|
#7
|
||||
|
||||
Sadly, nothing.. Nothing get's printed.
I used echo $vboptions['journals_recentdisplaylimit']; |
#8
|
||||
|
||||
the t-string error could've been fixed by doing this
PHP Code:
|
#9
|
||||
|
||||
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? |
#10
|
||||
|
||||
Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|