Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

filipeServer

Categoria em php nao amostro

Recommended Posts

olA

Preciso de ajuda tem que mostar todas as categoria mas so aparece uma que é a primeira na data base

mas eu queria que aparecesse em lista com todas as categoria

DEM uma olhada na foto

 

vou1br.jpg

<?php
session_start();

include("./common/auth.php");
include("./common/func.php");
include("./common/config.php");

$userLogin = $user->getLogin(); 

if(empty($userLogin)){
	header("Location: /");
	die;
}

include("./common/page_tree.php");
//include("./common/news_tree.php");
//include("./common/mall_tree.php");
include("./common/cart_info.php");

if(isset($_GET['count'])) $page_count = $_GET['count'];
else $page_count = 0;
if(isset($_GET['pagen'])) $page_number = $_GET['pagen'];
else $page_number = 1;

require('./db/db_config.php');
$link=mssql_connect($database['db_host'],$database['db_login'],$database['db_password']) or die(mssql_get_last_message());
mssql_select_db($database['db_name'],$link) or die("Database unavailable");

require_once('./common/mall_options.php');

if(isset($_GET['id'])){
	$id = intval($_GET['id']);
	$query = "select * from Items where id = $id";
	$item_info = mssql_fetch_assoc(mssql_query($query, $link));
	
	$content_template="mall_item.php";
	
	$brumble = '<a href="index.php">Home</a>|<a href="/mall_items.php">Item Mall</a>';
	$brumble_name = "ITEM MALL";
	
	require_once('./common/site_options.php');
	include("./templates/$site_template/index.php");
	die();
}

if(isset($_GET['todo'])){
	switch ($_GET['todo']) {
		case 'wish' :
			if(isset($_GET['id'])){
				$id = intval($_GET['id']);
				$query = "insert into WishList (item_id, quantity, account) values('$id',1,'$userLogin');";
				mssql_query($query, $link);
				$info = "Item added to wish list.";
			}
		break;
	}
}

if(isset($_GET['category'])){
	$catId = intval($_GET['category']);
	$query = "select * from Item_Categories where category_id = $catId";
	$res = mssql_fetch_assoc(mssql_query($query, $link));
}
else{
	$query = "select top(1) * from Item_Categories order by id asc";
	$res = mssql_fetch_assoc(mssql_query($query, $link));
	$catId = $res['id'];
}
$category_name = $res['category_name'];
$query = "select * from Items where category_id = $catId and quantity > 0 order by item_order asc";
$total_rows = mssql_num_rows(mssql_query($query, $link));

$main_file = 'mall_items';
include("./common/links.php");

$query = "SELECT *
FROM (SELECT ROW_NUMBER() OVER (ORDER BY Items.item_order ASC) AS Row, 
* FROM Items where category_id = $catId and quantity > 0) AS A 
WHERE A.Row >= $select_from AND A.Row <= $select_to";
$item_list = mssql_query($query, $link);

$current_section_name = "mall";
$content_template="mall_items.php";

$brumble = '<a href="index.php">Home</a>|<a href="mall_items.php">Item Mall</a>|<a class="current" href="">'.$category_name.'</a>';
$brumble_name = strtoupper($category_name); 

require_once('./common/site_options.php');
include("./templates/$site_template/index.php");

mssql_close($link); 
?>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.