<?php
/*
* Created on 2011-12-20
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
@mysql_connect("localhost","root")
or die ("连接数据库服务器失败");
@mysql_select_db("mydb")
or die ("数据库不可用或不存在");
$serial_no=$_POST['serial_no'];
$name=$_POST['name'];
$age=$_POST['age'];
$bthday=$_POST['bthday'];
$salary=$_POST['salary'];
$bonus=$_POST['bonus'];$query=mysql_query("insert into mytable(serialz_no,name,bthday,salary,bonuss) values($serial_no,'$name',$age,'$bthday',$salary,$bonus)")
or die ("sql语句执行错误");
if($query) echo "插入数据成功";else
echo "数据插入失败";
mysql_close();
?>
/*
* Created on 2011-12-20
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
@mysql_connect("localhost","root")
or die ("连接数据库服务器失败");
@mysql_select_db("mydb")
or die ("数据库不可用或不存在");
$serial_no=$_POST['serial_no'];
$name=$_POST['name'];
$age=$_POST['age'];
$bthday=$_POST['bthday'];
$salary=$_POST['salary'];
$bonus=$_POST['bonus'];$query=mysql_query("insert into mytable(serialz_no,name,bthday,salary,bonuss) values($serial_no,'$name',$age,'$bthday',$salary,$bonus)")
or die ("sql语句执行错误");
if($query) echo "插入数据成功";else
echo "数据插入失败";
mysql_close();
?>
or die ("sql语句执行错误");
也是执行错误!???????????????????????
$sql = "insert into mytable(serialz_no,name,bthday,salary,bonuss) values('".$serial_no."','".$name."','".$age."','".$bthday."','".$salary."','".$bonus."')";
$query=mysql_query($sql);你试试