09-20-2007, 04:28 AM
It's possible to show only category in my news?, how?. For example, I would like to show one category (for example car) in my page car.php, category trucks in my page trucks.php, etc. Thank you.
In my news I have many categories. ¿It's possible to add any code in my news.php (for example, news.php?car, news.php?truck) to show that category that I want?. Thank you.
isset($_GET['action']) ? $action = $_GET['action'] : $action = '';
And add below it:
if (!isset($urlGetCat))
{
isset($_GET['category']) ? $urlGetCat = $_GET['category'] : $urlGetCat = '';
}
And then in news.php
Find:
$getnews = $DB->query("SELECT * FROM `unp_news` ORDER BY `date` DESC LIMIT $newslimit");
Replace with:
$getnews = $DB->query("SELECT * FROM `unp_news` WHERE `catid`='$urlGetCat' ORDER BY `date` DESC LIMIT $newslimit");
Now, if you are using frames, just include news.php?category=categorynumber, replacing categorynumber for each instance. If you are using PHP includes, link to your page as normal and add ?category=categorynumber to the link.
Let me know if anything is unclear.
isset($_GET['action']) ? $action = $_GET['action'] : $action = '';
And add below it:
if (!isset($urlGetCat))
{
isset($_GET['category']) ? $urlGetCat = $_GET['category'] : $urlGetCat = '';
}
And then in news.php
Find:
$getnews = $DB->query("SELECT * FROM `unp_news` ORDER BY `date` DESC LIMIT $newslimit");
Replace with:
$getnews = $DB->query("SELECT * FROM `unp_news` WHERE `catid`='$urlGetCat'[/B] ORDER BY `date` DESC LIMIT $newslimit");
Now, if you are using frames, just include news.php?category=categorynumber, replacing categorynumber for each instance. If you are using PHP includes, link to your page as normal and add ?category=categorynumber to the link.
Let me know if anything is unclear.
I have this error (I have intalled News Illustrated)
Database error in Utopia News Pro:
Invalid SQL Query: SELECT * FROM `unp_news` WHERE `catid`=''[/B] ORDER BY `date` DESC LIMIT 10
MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[/B] ORDER BY `date` DESC LIMIT 10' at line 1
MySQL Error Number: 1064
Date: September 27, 2007 12:27 PM
Script: /
