以下是我从registration.php 页面重定向的test.php 页面。除了 sql 查询,这里的一切都很好。所有警报标签都很好地显示了会话变量值,但此页面给出了“错误,插入查询失败”错误。尝试了所有可能性,例如查询中变量的引号等,但没有任何效果..请有人帮忙..
<?php
include "connect.php";
session_start();
$ser= $_SESSION['service'];
$comp=$_SESSION['comp'];
$yr= $_SESSION['year'];
$addr= $_SESSION['addr'];
$per= $_SESSION['per'];
$no= $_SESSION['no'];
$email= $_SESSION['email'];
$uname= $_SESSION['uname'];
echo "<script>alert('$ser')</script>";
echo "<script>alert('$comp')</script>";
echo "<script>alert('$yr')</script>";
echo "<script>alert('$no')</script>";
echo "<script>alert('$addr')</script>";
if($ser=='designing'){
$ser=1;
}else if($ser=='webdev'){
$ser=2;
}else{
$ser=3;
}
echo "<script>alert('$ser')</script>";
$sql= "insert into login values
('$uname','xxxx',$ser,'$comp',$yr,'$addr','$per',$no,'$email')";
mysql_query($sql) or die('Error, insert query failed');
?>
<span style="font-family:Tahoma; font-weight:bold; font-size:11px;color:#666666"
align=center>Your Registration is successful...<br/>Our team will contact you at
the earliest...
</span>