这是我的 php 代码,它无法正常工作....
它不接受处于 if 条件的查询,并且每次执行 else 部分时......
<?php
include('admin/class.php');
** 这是我的数据库连接**
$hostname="localhost";
$username="root";
$password="";
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
$se = mysql_select_db("timesheet1234",$dbhandle)
or die("Could not select timesheet1234");
echo "connected to db";
if(isset($_POST['save']))
{
echo "post if";
$sel=@$_POST['selpro'];
$mon=@$_POST['mon'];
$tue=@$_POST['tue'];
$wed=@$_POST['wed'];
$thu=@$_POST['thu'];
$fri=@$_POST['fri'];
$sat=@$_POST['sat'];
$sun=@$_POST['sun'];
这是我的代码问题开始的地方,它不能正常工作
if(isset($_SESSION['user']))
{
echo "session user";
$sql="UPDATE empdaytimesheet SET `project code`='$sel',`mon`='$mon',`tue`='$tue',`wed`='$wed',`thu`='$thu',`fri`='$fri',`sat`='$sat',`sun`='$sun' where `username`='".$_SESSION['user']."'";
$res=mysql_query($sql,$dbhandle);
if($res){
echo "<script type='text/javascript'>";
echo "alert('TimeSheet Saved..!')";
echo "</script>";
echo "<script type='text/javascript'>";
echo "window.location='my_timesheet.php'";
echo "</script>";
}
else
{
echo "<script type='text/javascript'>";
echo "alert('Some Error Occured ! Retry..!')";
echo "</script>";
echo "<script type='text/javascript'>";
echo "window.location='my_timesheet.php'";
echo "</script>";
}
}
}
?>