Cafte, tak mam kod:
page.php
<?php
if(isset($_GET['page'])){
$page=$_GET['page'];
$page2=$page.".php";
if(file_exists($page2)){
header("Location: $page2");
}}
?>
MyDb.class.php
<?php
/*
CREATE DATABASE `games` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE TABLE `games`.`hry` (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` TINYTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
`other` TINYTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
`category` TINYTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci
*/
class MyDb{
public $sql;
public $connect;
function __construct(){
require_once('password.php');
$this->connect = mysql_connect($mysqlhost, $mysqluser, $mysqlpasswd);
mysql_select_db("games");
}
function vypis($sql){
require('page.php');
$this->sql= mysql_query("SELECT * FROM hry WHERE category>='$page' ORDER BY id DESC");
while($row = mysql_fetch_array($this->sql)){
echo $row["name"];
echo $row["other"];
}
}
}
index.php:
tu testujem ci funguje vypisovanie iba hier z danej kategorie na stranke pre danu kategoriu, funguje to tak ze sa zaznam v DB porovnava s $page a vypise iba potrebne hry z danej kategorie
<?php
require('head.php');
require('MyDb.class.php');
?>
<a href="index.php?page=arkada">kat</a>
<?php
$in = new MyDb();
$in->vypis($sql);
?>
a tu uz je stranka danej kategorie arkady:
arkada.php
<?php
require('head.php');
require('page.php');
require('MyDb.class.php');
?>
stranka kategorie
<?php
$in = new MyDb();
$in->vypis($sql);
?>
A chyba je v tom ze pri kliknuti na odkaz mi spadne cele Apache prosim napiste vsetko co by ste opravili, dakujem