אין שגיאות, כמו שאמרתי, הוא מציג את המידע מצויין!
רק שזה לא יעיל שאני צריך לעשות פעמיים התחברות לבסיס הנתונים בשביל הקטע הזה בגלל שאני משתמש בפונקציות.
הקוד:
PHP קוד:
<?php
ob_start();
/**
*
* @package ------
* @version $id: index.php, v.0.1.8 20/05/2006 00:47:40
* @copyright (c) 2006 Ron Alter and EliHai Sasi
*
*/
/*
* Index page
*/
// define the core path
define('CORE', './core/');
// require database class and connect
require_once CORE . "classes/database.php";
$db = new database;
$db1 = new database;
// connect to mysql with class and config
//require_once . "./conf_global.php";
$db->connect('localhost', 'user', 'pass', 'user');
$db1->connect('localhost', 'user', 'pass', 'user');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="script.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
<link rel="stylesheet" type="text/css" href="css/global.css">
</head>
<body>
<?php
if($_GET['act'] == "view") {
$db->query("SELECT * FROM categories ORDER BY id aSC");
while ($categorie = $db->fetch_array()) {
$rows = $db->num_rows();
if(!empty($rows)) {
?>
<table border="0" width="85%" class="table">
<tr>
<td class="td1"><div align="center" class="text_title"><? echo $categorie['category'] ?> - id <? echo $categorie['id'] ?></div></td>
</tr>
<?
$db1->query("SELECT * FROM articles WHERE cid = " . $categorie['id'] . " ORDER BY title ASC");
while($x = $db1->fetch_array()) {
echo " <tr>
<td class='text'><a href='articles.php?id=" . $x['id'] . "&cid=" . $x['cid'] . "' class='text'>" . $x['title'] . "</a></td>
</tr>
";
}
?>
</table>
<?
}
elseif(empty($rows)) {
echo (" ");
}
}
}
?>
<?php ob_end_flush(); ?>
אני זז לישון, בבוקר אני חוזר, תודה על העזרה.