<?php
if(isset($_POST["submit"])) ..this is form action
{
$result3 = mysql_query("SELECT * FROM 'members' where user='$user'");
while($row3 = mysql_fetch_array($result3))
{
$name=$row3['name'];
$user=$row3['user'];
$number=$row3['number'];
}
$numrows=mysql_num_rows($query);
if($numrows==0)
{
$sql="INSERT INTO 'applicant' (user,name,number,) VALUES('$user','$name','$number')";
$result=mysql_query($sql);
if($result){
header('Location: thankyou2.php');
} else {
echo "Failure!";
}
}
}
else
{
$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "abcdef";
$prefix = "";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Could not connect database");
mysql_select_db($mysql_database, $bd) or die("Could not select database");
$JobID=$_GET['JobID'];
$job_sql="SELECT * FROM job WHERE JobID=$JobID";
$job_query = mysql_query($job_sql) or die(mysql_error());
$rsjob=mysql_fetch_assoc($job_query);
};
?>
<b><center><table class="bordered">
(数据将通过GET方法在此表中获取)
<thead>
<?php echo $rsjob['jobname'];?></h1></font>
<tr>
<th><font face="Script MT">Description</th>
<th><font face="Script MT">Details</th>
</tr>
</thead>
<tr>
<td>Name</td>
<td><?php echo $rsjob['jobname'];?></td>
</tr>
<tr>
<td>Type</a></td>
<td><?php echo $rsjob['type'];?></td>
</tr>
</table><br>
<?php
if ($loggedin)
{
echo
<<<_END
<form action="job.php" method="POST" name="jobapply">
<input type="checkbox" name="termscondition" required/> I have read all the
<a href="termscondition.html">Terms and Condition</a><br>
<br><input type="submit" value="Apply"></form>
_END;
}
else
{
echo '<center> please sign up and/or log in to <strong>Apply</strong>.</center>';
};
?>
单击“提交”按钮,用户信息将存储在abcdef数据库的申请者表中。 错误:您的SQL语法中有错误;检查与MySQL服务器版本对应的手册,以便在第1行的''附近使用正确的语法
答案 0 :(得分:3)
您的列中似乎有一个额外的逗号,而且您的表名在引号中,请尝试更改此行:
$sql="INSERT INTO 'applicant' (user,name,number,) VALUES('$user','$name','$number')";
到此
$sql="INSERT INTO applicant (user,name,number) VALUES('$user','$name','$number')";
我认为问题出在(user,name,number)
和'applicant'
答案 1 :(得分:2)
尝试从表名中删除引号,例如:
[HttpPost]
public PartialViewResult FillMobileDetails(string mobileName)
{
Response.Write("test3");
Model=new Mob();
Model.MobileEmi="somEmi";
//get emi and else if need
return Json(new {emi=Model.MobileEmi,detail1="something"});
}
变为:
$result3 = mysql_query("SELECT * FROM 'members' where user='$user'");