my php code for adding is not working [don't know why]
when i press add button, it is showing white screen. nothing else
here is some info about my database
two tables: title and words
in title, fields: id and word
in words, fields :id, title, descr, example, synonim, user
here is the code for add.php
Code: Select all
<?php
mysql_connect("*********", "*****", "**************") or die(mysql_error());
mysql_select_db("*************") or die(mysql_error());
if (isset($_POST['add']))
{
$sql = "INSERT INTO words (title, descr, example, synonim, user) VALUES ('$_POST[title]', '$_POST[descr]', '$_POST[example]', '$_POST[related]', '$_POST[user]')";
$result = mysql_query($sql);
$check_title = mysql_query("select*from title where word='$_POST['title']");
$rows = mysql_num_rows($check_title);
echo $rows;
if ($rows==0)
{
$sql = "INSERT INTO title (word) VALUES ('$_POST[title]')";
$result = mysql_query($sql);
} else {}
}
?>
<html>
<head><title>Added</title></head>
<link href="css/graffiti.css" rel="stylesheet" type="text/css">
<body>
<div id="wrapper">
<div id="header">
<p id="home">
<a href="index.php">Jargon.uz</a>
</p>
</div>
<div id="navigation">
<p id="menu">
<?php
foreach (range('A', 'Z') as $letter)
{
echo '<a href="az.php?category='.$letter.'">'.$letter.'</a> ';
}
?>
:: <a href="all.php">xamma so`zlar</a> <a href="random.php">tasodifiy</a> :: <a href="add.html">kirit</a> <a href="chat.php">chat</a> <a href="themes.html">temalar</a>
</p>
</div>
<div id="leftcolumn">leftcol</div>
<div id="content">
<center>Your data has been added successfully!</center>
</div>
<div id="footer">footer</div>
<div id="about">
<center>
<p id="copyright">
Jargon.uz © 2009 [project of Akmal] :: <a href="aboutus.html">sayt haqida</a> <a href="fq.html">foydalanish qoidalari</a> <a href="svt.php">savol va takliflar</a> <a href="ads.html">reklama</a>
</p>
</center>
</div>
</div>
</body>
</html>