Programming Scripts explain the way news
We work a new database and let us call it, for example, al5berekuw111
And then we Bnchae user base and connect them with some Albyant
And after we drive to the same SQL to the database and are installing tables Venketb following code
Code PHP:
CREATE TABLE news (
id int(10) unsigned NOT NULL auto_increment,
postdate timestamp(14),
author varchar(50) NOT NULL,
title varchar(50) NOT NULL,
news text NOT NULL,
PRIMARY KEY (id),
KEY postdate (postdate)
);
This code claimed arises us a 5 tables
id
author
title
news
date
And Jve Anhna Htina postdate timestamp14 and claimed this history is written in the database without any codes Additional
Of course like any scripts necessary link rule Elly Swinneha contact file Ashan well as claimed the feminist file
config.php
Using the PHP Coder program
And determine which claimed the number of news Nbgaha who looked us in the page
Important to write in the file
Code PHP:
// this file was made as aresult of alwannah's php tutorials
// for more ideas please visit [url=http://www.jeddahbar.com]jeddahbar[/url]
// Rule Information
$dbhost = "localhost"; $dbname = "Database Name"; $dbuser = "Database user name"; $dbpass = "Password database";
// Contact to the base operation
mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error());
// Here specify the number of news that appear in the script and unity here 5 News
$max_items = “5”;
This is to determine the part number of articles
$ Max_items = "5"
Preferably a 5 per page
And now to have stepped Njie 3
Now we make a template for writing the article or story and tell a html
This code is put in the page with tobacco who writes the story for display
Code PHP:
<form name=”newsubmit” method=”post” action=”nsubmit.php”> بواسطة: <input type=”text” name=”author”><br> العنوان: <input type=”text” name=”title”><br> المقاله: <textarea name=”news” rows=”6” cols=”24”></textarea><br>
<input type=”submit” name=”submit” value=”ارسال المقاله”>
</form>
This is a primitive template of course, you can modify it and develop it as you like
Now we call womanly file nsubmit.php to send the news after what you write a template tied to who I spoke with him before shui This claimed the file performs the input information in the database to formic
One of the two parts is initially connect to the base
The second is to insert information and stored in the base
Code PHP:
<?php
// التصال مع ملف الكونفيقريشن
include “config.php”;
// سحب المدخلات من الفورم
$author = $_POST['author']; $title = $_POST['title']; $news = $_POST['news'];
// ادخال المعلومات في قاعده البيانات
$query = "INSERT INTO news (author, title, news)
VALUES('$author', '$title', ‘$news')"; mysql_query($query) or die(mysql_error());
echo "شكرا. لقد تم ارسال المقالة!";
?>
Easy true !!!!!!!!!!!
Ehna well written article Khoznaha in the database now, the rest of how we offer articles from the base
Claimed the feminist named nview.php file and this will tell a to view files and of course Amdec Tahth in your board or other or any script Tbgah
Leave your thoughts but Adhikm fundamentals generally be claimed its contents
Code PHP:
<?
// التصال مع ملف الكونفيقريشن include ’config.php’;
global $max_items;
// تحديد طريقه العرض
$query = “SELECT id, author, title, news,” . “DATE_FORMAT(postdate, ‘%y-%m-%d’) as date “ . FROM news ORDER BY postdate DESC LIMIT $max_items”; $result = mysql_query ($query);
// احضار المعلومات
while ($row = mysql_fetch_assoc ($result)) {
// تخزين القيم
$author = strip_tags( $row['author']); $date = $row[‘date’]; $title = strip_tags( $row[‘title’]) $news = nl2br (strip_tags ($row[‘news’], ‘<a><b><i><u>’));
// عرض المقالات
echo “$title بواسطة $author بتاريخ $date”;
echo “$news <br><br>”;
}
?>