Page 2 of 2

Re: Getting data from MySQL

Posted: Mon Nov 29, 2010 9:16 am
by Celauran
You've redirected all traffic to your controller page via .htaccess?

Re: Getting data from MySQL

Posted: Mon Nov 29, 2010 9:41 am
by someguyhere
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?

Re: Getting data from MySQL

Posted: Mon Nov 29, 2010 9:49 am
by Celauran
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]

Re: Getting data from MySQL

Posted: Mon Nov 29, 2010 11:46 am
by someguyhere
Works like a charm! Thanks again!

Re: Getting data from MySQL

Posted: Mon Nov 29, 2010 5:36 pm
by someguyhere
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:

Image

Re: Getting data from MySQL

Posted: Mon Nov 29, 2010 6:54 pm
by Celauran
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?
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.