Getting data from MySQL
Moderator: General Moderators
Re: Getting data from MySQL
You've redirected all traffic to your controller page via .htaccess?
-
someguyhere
- Forum Contributor
- Posts: 181
- Joined: Sun Jul 27, 2008 3:24 pm
Re: Getting data from MySQL
I've tried, but I isn't working as it should. I'm assuming I need to set it up differently than a normal 301?
How would I set up the .htaccess file in this case?
How would I set up the .htaccess file in this case?
Re: Getting data from MySQL
Try something like this
Code: Select all
# Turn on URL rewriting
RewriteEngine On
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]
-
someguyhere
- Forum Contributor
- Posts: 181
- Joined: Sun Jul 27, 2008 3:24 pm
Re: Getting data from MySQL
Works like a charm! Thanks again!
-
someguyhere
- Forum Contributor
- Posts: 181
- Joined: Sun Jul 27, 2008 3:24 pm
Re: Getting data from MySQL
By the way Celauran, is there a simple way to modify the existing code to load the contents of the entire row (the data for the page contents) into another array so that I don't have to make 2 DB calls?
If it helps, my db is set up as such:

If it helps, my db is set up as such:

Re: Getting data from MySQL
Just change the query to "SELECT * FROM ag_pages WHERE page_url = '{$_SERVER['REQUEST_URI']}'". If the page isn't there, the query will return false. You won't need your in_array check anymore, either.someguyhere wrote:By the way Celauran, is there a simple way to modify the existing code to load the contents of the entire row (the data for the page contents) into another array so that I don't have to make 2 DB calls?