ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
This fixes it for me, I had the same trouble:
- Last line fixed as above
- 3rd line fixed in red
Code:$sql = "SELECT e.*, et.* FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et WHERE e.pages_id = '" . (int)$ezpage_id . "' AND et.languages_id = '" . (int)$_SESSION['languages_id'] . "' AND e.pages_id = et.pages_id";
FWIW, you shouldn't need (and don't want) those single quotes around the ez_pages_id (assuming it's still an int(11) database type). That is, instead of
$sql = "SELECT e.*, et.* FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et WHERE e.pages_id = '" .(int)$ezpage_id. "' AND et.languages_id = '" . (int)$_SESSION['languages_id'] . "' AND e.pages_id = et.pages_id";
the code should read:
$sql = "SELECT e.*, et.* FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et WHERE e.pages_id = " .(int)$ezpage_id. " AND et.languages_id = '" . (int)$_SESSION['languages_id'] . "' AND e.pages_id = et.pages_id";
Hello lat9,
Thanks for the correction, I tested and indeed that works just as well( aside: I tried to find out what the dot notation means here, but without success. I understand that if the variable is an integer then quotes are not required (field = int_value), but how is the languages_id part different, if it is also cast into an int? I tested, and there the single quotes do not seem to be required either. So the total query is then:
Is that consistent and correct?Code:$sql = "SELECT e.*, et.* FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et WHERE e.pages_id = ' . (int)$ezpage_id . " AND et.languages_id = ' . (int)$_SESSION['languages_id'] . " AND e.pages_id = et.pages_id";
Addition: removal of single quotes can then be done similarly in line 7 of the pages_order_query around (int)$_SESSION['languages_id'] .
Actually, you've got single-quotes (highlighted above) that should be a double-quote (or a debug-log will be generated):
Code:$sql = "SELECT e.*, et.* FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et WHERE e.pages_id = " . (int)$ezpage_id . " AND et.languages_id = ". (int)$_SESSION['languages_id'] . " AND e.pages_id = et.pages_id";
Hello lat9,
Sorry, it looks like that was a mistake in my quote (editing while posting not good idea!), I checked and I see in the current code I have double quotes as you state in your post. Whew, thanks for correcting that.