06-28-2008, 07:06 PM
|
#1 (permalink)
|
|
Moderator
Join Date: Sep 2007
Location: Near you.
Posts: 450
Thanks: 228
|
Cant u switch with the use of cat=1 cat=2 etc? [!Read!]
I use this code, in my other link system to switch to cat 1 for the first link and then cat 2 for the other links that has the cat_id to 2, or 3 etc..
Quote:
#But now when i try to implement the code to my news system
it some how do not work ? :S
Help would be great
Thank you in advance:
|
PHP Code:
<?php
$webq = "select id, name, des from news ";
if(isset($_GET['cat']))
{
$webq .= sprintf("where cat_id = '%s'", mysql_real_escape_string($_GET['cat']));
}
$web_result = mysql_query($webq);
if(!cat_result)
{
echo mysql_error();
}
$catq = "select id, name from cat";
$cat_result = mysql_query($catq);
?>
<?php
while($cat_row = mysql_fetch_array($cat_result))
{
?>
<a href="index.php?cat=<?php echo $cat_row['id'];?>"><?php echo $cat_row['name'];?></a>
<?php
}
?>
Thank you!
|
|
|
|