binboy
Member
سلام
من می خوام یک صحفه که داخلش یک فرم است را به دیتابیس ارتباط بدم تا اطلاعات در آنجا ذخیره بشه بیشتر کارهاش را انجام دادم ولی متاسفانه با مشکل مواجه شد.
لطفا کمک کنید:
کد ارور:
کد صحفه dbconnector.php:
و کد صحفه ای که فرم در ان است:
لطفا کمک کنید تا با دیتابیس ارتباط برقرار کنم.اگر جایی باید اصلاح بشه را بگید.
با تشکر
من می خوام یک صحفه که داخلش یک فرم است را به دیتابیس ارتباط بدم تا اطلاعات در آنجا ذخیره بشه بیشتر کارهاش را انجام دادم ولی متاسفانه با مشکل مواجه شد.
لطفا کمک کنید:
کد ارور:
کد:
Parse error: parse error in d:\program files (x86)\easyphp1-8\www\db\dbconnector.php on line 14
PHP:
<?php
//dbconnector.php
//Define the mysql connection variables.
define ("MYSQLHOST", "localhost");
define ("MYSQLUSER", "root");
//define ("MYSQLPASS", "");
define ("MYSQLDB", "data");
function opendatabase(){
$db = mysql_connect (MYSQLHOST,MYSQLUSER);
mysql_query('SET NAMES utf8');
try {
if (!$db){
$exceptionstring = "Error connection to database: <br />";
$exceptionstring .= mysql_errno() . ": " . mysql_error();
throw new exception ($exceptionstring);
} else {
mysql_select_db (MYSQLDB,$db);
}
return $db;
} catch (exception $e) {
echo $e->getmessage();
die();
}
}
?>
PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK rel=stylesheet type=text/css href="css/admin-zig.css">
<script type="text/javascript" src="js/jquery-1.2.6.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".formContainer input[type=text]").focus(function(){
$(this).parent().find(".error").css("display", "none");
$(this).parent().find(".info").css("display", "block");
}).blur(function(){
$(this).parent().find(".info").css("display", "none");
});
});
function validateForm()
{
$(".formContainer input[type=text]").each(function(){
var text = $(this).attr("value");
if (text == "")
{
$(this).parent().find(".error").css("display", "block");
}
});
}
function clearForm()
{
$(".formContainer input[type=text]").each(function(){
$(this).parent().find(".error").css("display", "none");
});
}
</script>
</head>
<?php
if(isset($_POST['name'],$_POST['lastname'],$_POST['mobail'],$_POST['phone'],$_POST['address'],$_POST['tallcoat'],$_POST['chestcireumterence'],$_POST['sleevelehgth'],$_POST['shoulder'],$_POST['waist'],$_POST['tallpants'],$_POST['buttocks'],$_POST['thigh'],$_POST['knee'],$_POST['dmpa'],$_POST['faq']))
{
$name=$_POST['name'];
$lastname=$_POST['lastname'];
$mobail=$_POST['mobail'];
$phone=$_POST['phone'];
$address=$_POST['address'];
$tallcoat=$_POST['tallcoat'];
$chestcireumterence=$_POST['chestcireumterence'];
$sleevelehgth=$_POST['sleevelehgth'];
$shoulder=$_POST['shoulder'];
$waist=$_POST['waist'];
$tallpants=$_POST['tallpants'];
$buttocks=$_POST['buttocks'];
$thigh=$_POST['thigh'];
$knee=$_POST['knee'];
$dmpa=$_POST['dmpa'];
$faq=$_POST['faq'];
require_once ("../db/dbconnector.php");
$db = opendatabase();
$query ="select * from emkanat";
$result=mysql_query($query);
$id=mysql_num_rows($result);
$id=$id+1;
$query="insert into emkanat values ('".$id."','".$name."','".$lastname."','".$mobail."','".$phone."','".$address."','".$tallcoat."','".$chestcireumterence."','".$sleevelehgth."','".$shoulder."','".$waist."','".$tallpants."','".$buttocks."','".$thigh."','".$knee."','".$dmpa."','".$faq."')";
$result=mysql_query($query);
mysql_close();
}
else {
?>
<body class="body">
<div class="menu1"></div>
<div class="menu2"></div>
<div class="menu3"></div>
<div class="menu4"></div>
<div class="line-menu"></div>
<a href="www.zigweb.ir" target="blank" class="exit"></a>
<a href="www.zigweb.ir" target="blank" class="help"></a>
<a href="www.zigweb.ir" target="blank" class="settings"></a>
<a href="www.zigweb.ir" target="blank" class="home"></a>
<div class="main"></div>
<div class="line-top1"></div>
<div class="dor-lt1"></div>
<div class="dor-rt1"></div>
<div class="dor-bl1"></div>
<div class="dor-br1"></div>
<div class="line-bottom1"></div>
<div class="line-right1"></div>
<div class="line-left1"></div>
<div class="form"><div class="content">
<fieldset class="formContainer">
<h1>مشخصات فردی:</h3>
<form action="customer-registration.php" method="post">
<div class="rowContainer">
<label for="txtFirstname">نام</label>
<input id="fild1" type="text" name="name" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<div class="rowContainer">
<label for="txtLastname">نام خانوادگی</label>
<input id="fild1" type="text" name="lastname" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<div class="rowContainer">
<label for="txtEmail">شماره همراه</label>
<input id="fild1" type="text" name="mobail" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<div class="rowContainer">
<label for="txtEmail">شماره ثابت</label>
<input id="fild1" type="text" name="phone" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<div class="rowContainer">
<label for="txtFirstname">آدرس</label>
<input id="fild1" type="text" name="address" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<h1>کُت:</h3>
<div class="rowContainer">
<label for="txtFirstname">قد کت</label>
<input id="fild1" type="text" name="tallcoat" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<div class="rowContainer">
<label for="txtLastname">دور سینه</label>
<input id="fild1" type="text" name="chestcireumterence" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<div class="rowContainer">
<label for="txtEmail">قد آستین</label>
<input id="fild1" type="text" name="sleevelehgth" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<div class="rowContainer">
<label for="txtEmail">شانه</label>
<input id="fild1" type="text" name="shoulder" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<h1>شلوار:</h3>
<div class="rowContainer">
<label for="txtAddress">کمر</label>
<input id="fild1" type="text" name="waist" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<div class="rowContainer">
<label for="txtAddress">قد</label>
<input id="fild1" type="text" name="tallpants" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<div class="rowContainer">
<label for="txtAddress">باسن</label>
<input id="fild1" type="text" name="buttocks" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<div class="rowContainer">
<label for="txtAddress">ران</label>
<input id="fild1" type="text" name="thigh" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<div class="rowContainer">
<label for="txtAddress">زانو</label>
<input id="fild1" type="text" name="knee" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<div class="rowContainer">
<label for="txtAddress">دمپا</label>
<input id="fild1" type="text" name="dmpa" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<div class="rowContainer">
<label for="txtAddress">فاق</label>
<input id="fild1" type="text" name="faq" />
<div class="tooltipContainer error">لطفا این فیلد را پر نمایید.</div>
</div>
<input type="submit" value="ثبت" />
</fieldset><br />
</div></div></form>
<?php }?>
</body>
</html>
با تشکر