كنت قاعد فاضى شويتين قلت اعمل تطبيق كده على السريع أخذ منى ساعتين (بالنسبة لمبتدئ)
قاعدة البيانات
كود:
-- phpMyAdmin SQL Dump
-- version 2.11.0
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 02, 2008 at 11:20 AM
-- Server version: 5.0.45
-- PHP Version: 5.2.4
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `forum`
--
-- --------------------------------------------------------
--
-- Table structure for table `forums`
--
CREATE TABLE `forums` (
`id` int(11) NOT NULL auto_increment,
`topicname` varchar(150) NOT NULL,
`topic` varchar(250) NOT NULL,
`username` varchar(150) NOT NULL,
`date` varchar(150) NOT NULL,
`group` varchar(150) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
--
-- Dumping data for table `forums`
--
INSERT INTO `forums` (`id`, `topicname`, `topic`, `username`, `date`, `group`) VALUES
(1, 'name topic 1', 'contains of topic 1 fdsfsdfsdfgfdjdjhl;dghgf hfgjh gl;g gfhkld;f hkld gfdhk;lgkh;ldfghdf', 'zizo', '2-5-2010', 'Question'),
(2, 'name topic 2', 'contains of topic 2 fdsfsdfsdfgfdjdjhl;dghgf hfgjh gl;g gfhkld;f hkld gfdhk;lgkh;ldfghdf', 'ramy', '3-5-2010', 'Support'),
(3, 'name topic 3', 'contains of topic 3 fdsfsdfsdfgfdjdjhl;dghgf hfgjh gl;g gfhkld;f hkld gfdhk;lgkh;ldfghdf', 'zizo1', '4-5-2010', 'Question'),
(4, 'name topic 4', 'contains of topic 4 fdsfsdfsdfgfdjdjhl;dghgf hfgjh gl;g gfhkld;f hkld gfdhk;lgkh;ldfghdf', 'Rami2', '5-5-2010', 'Offtopic');
وعملت ملفين الاول index.php
كود PHP:
<?php
mysql_connect("localhost","root","");
mysql_select_db("forum");
$sql = mysql_query("select * from forums ");
echo"<table border = 1>
<tr>
<td width = 150>ID</td>
<td width = 150>Topic Name</td>
<td width = 150>Writer</td>
<td width = 150>Date</td>
<td width = 150>Group</td>
</tr>
</table>";
while($mysqlf = mysql_fetch_array($sql)){
$id = $mysqlf ['id'];
$topicname = $mysqlf ['topicname'];
$topic = $mysqlf ['topic'];
$username = $mysqlf ['username'];
$date = $mysqlf ['date'];
$group = $mysqlf ['group'];
echo"<table border = 1 >
<tr>
<td width = 150>$id</td>
<td width = 150><a href=/viewtopic.php?id=$id>$topicname</a></td>
<td width = 150>$username</td>
<td width = 150>$date</td>
<td width = 150>$group</td>
</tr>
</table>";
}
?>
والاخر viewtopic.php
كود PHP:
<?php
//connect to data base
mysql_connect("localhost","root","");
mysql_select_db("forum");
// get id of topic here
$id = $_GET['id'];
$sql = mysql_query("select * from forums where id = '$id' ");
$mysqlf = mysql_fetch_array($sql);
$id = $mysqlf ['id'];
$topicname = $mysqlf ['topicname'];
$topic = $mysqlf ['topic'];
$username = $mysqlf ['username'];
$date = $mysqlf ['date'];
$group = $mysqlf ['group'];
echo"<table border = 1 >
<tr>
<td width = 50>$username</td>
<td width = 300 hight = 300>$topic</td>
</tr>
</table>";
echo "<br><br><br> <a href=/index.php> Go To Home Page</a>";
?>
ويمكنك مشاهدة التطبيق مباشرة من خلال
http://edafa.info/test
وأن كان هناك أى خطأ فأرجوا ابلاغى
وكان هناك سؤال محيرنى كيف اضع الاعدادت للقاعدة بملف config.php وكيف يمكن استدعائة مع العلم انى حاولت مع الدالة include وفشلت 
وتحياتى للجميع