config.php
<?php
///////////////////connect database/////////////////
$name="root";
$pass="";
$host="localhost";
$link=mysql_connect($host,$name,"");
if(!$link)
{
die(mysql_error());
}
else
echo "connected sucessfully";
/////////////// create database////////////////////////
$query="CREATE DATABASE IF NOT EXISTS myforum";
$result= mysql_query($query);
if(!query)
{
die(mysql_error());
}
else
echo "Database Created";
$result='';
$query='';
$query= "CREATE TABLE `section` (
`sid` int(11) NOT NULL auto_increment,
`section_name` varchar(250) NOT NULL,
`description` text NOT NULL,
PRIMARY KEY (`sid`))ENGINE=MyISAM DEFAULT CHARSET=cp1256 AUTO_INCREMENT=3";
mysql_select_db("myforum",$link);
$result=mysql_query($query,$link);
if(!$result)
{
echo"DB Error ,could not query the database<br>";
echo'MySQL Error: '.mysql_error();
exit;
}else
echo" the table sections is created sucessfully ";
?>index.php
<?php
$link = mysql_connect('localhost','root');
if(!$link)
{
die(mysql_error());
}
else
echo "connected sucessfully";
?>
<head>
<title>WELCOME TO MY FORUM</title>
</head>
<body>
<h1 align="center">Wellcome</h1>
<?php
$query="insert into section (section_name,description) values ('Web Sites Programming','this talk about all things related to Web Site programming language'),('Programming language','this is teke about all programming language like C .. C++ .. java'),('DataBase','this is take about DataBase')";
mysql_select_db("myforum",$link);
$result=mysql_query($query,$link);
if(!$result)
{
echo" <strong><center> Not inserted : ".mysql_error()." </strong></center>";
} else
echo "inserted sucessfully";
?>output
في المرفقات
ليه اتكرر تلات مرات؟؟؟؟؟؟؟
تم تعديل هذه المشاركة بواسطة ensana في 6 أغسطس 2007 في 02:20
