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");
And so, tried this:
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']");
But received a parse error:
Quote:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /var/www/html/getest/journal.php on line 818
|
I figured I'd try and get around this by applying it to a second variable, so tried this:
Code:
$recentdisplaylimit = $vboptions['journals_recentdisplaylimit'];
And then tried this 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 $recentdisplaylimit");
But I received a MySQL error:
Quote:
Invalid SQL:
SELECT u.username, j.journalid, j.title, j.description, j.timestamp, j.userid, j.entries, j.views
FROM journal j
LEFT JOIN user u ON u.userid = j.userid
WHERE j.enabled = 1
ORDER BY j.views DESC
LIMIT
mysql error: You have an error in your SQL syntax near '' at line 7
mysql error number: 1064
Date: Wednesday 12th of May 2004 02:22:07 PM
Script: xxxx://xxx.xxxxxxxxxxxxxx.xx.xx/getest/journal.php?
Referer: xxxx://xxx.xxxxxxxxxxxxxx.xx.xx/getest/
Username: Oblivion Knight
|
Can anyone please tell me a way to get around these problems? :nervous:
Oh - and if the SQL query is messy, don't blame me.. I didn't write it.!