السلام عليكم ورحمة الله وبركاتة
قمت بعمل اسكريبت للنكت ولكنة لاسف لايضيف اى موضع اضافتة الا قاعدة البيانات ياريت من الاخوة انهم يشيفوا الاسكريبت وياريت يجربوبة ويشوفوا الخطاء اية لانى تعبت واحتارت معاة جداااااااااااااا
<html>
<head>
<title>The Internet Joke Database</title>
</head>
<body>
<?php
$host="localhost"; //the name of localhost
$user="ahmed17"; //username
$pass="123456"; // mypasswd
$database="ahmed17"; //database name which created
$table="jokes"; // table name
//********************************************************
if (isset( $_GET['addjoke'])): // If the user wants to add ajoke
// Connect to the database server
$link=mysql_connect($host,$user,$pass)or print"failed connection";
// Select the jokes database
mysql_select_db($database,$link)or print"Could not open database";
////////////////////////////////////////////////////////////////|\
/*$sql = "CREATE TABLE Jokes ( \\
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, \\
JokeText TEXT, \\
JokeDate DATE NOT NULL \\
)"; \\
if ( @mysql_query($sql) ) { \\
echo("<p>Jokes table successfully \\
created!</p>") \\
} else { \\
echo("<p>Error creating Jokes table: " . mysql_error() \\
. "</p>"); \\
}
\\
///////////////////////////////////////////////////////////////*/
//******************************************************************************
// If a joke has been submitted,
// add it to the database.
if($_POST['submitjoke']=='SUBMIT')
{
$sql="INSERT INTO $table SET JokeText='$_POST['joketext'] ',JokeDate='CURDATE()'";
if(mysql_query($sql))
{
print("Your joke has been added.</p>");
}
else
{
print("Error adding submitted joke".mysql_error());
}
}
//******************************************************************************
print"<p> Here are all the jokes in our database:</p> ";
//******************************************************************************
// Request the text of all the jokes
$result=mysql_query("SELECT joketext FROM $table");
if(!$result)
{
print"<b>Error Performing Query</b>".mysql_error();
exit();
}
//******************************************************************************
// Display the text of each joke in a paragraph
while($row=mysql_fetch_array($result))
{
print("<p>" . $row["JokeText"] . "</p>");
}
//******************************************************************************
// When clicked, this link will load this page
// with the joke submission form displayed.
echo("<p><a href='$PHP_SELF?addjoke=1'>Add aJoke!</a></p>");
//******************************************************************************
endif;
?>
<form action="<?=$_SERVER['PHP_SELF']?>"
method="post">
<p>Type your joke here:<br />
<textarea name="joketext" rows="10" cols="40"
wrap></textarea><br />
<input type="submit" name="submitjoke" value="SUBMIT"
/></p>
</form>
</body>
</html>