我把自己逼疯了,想弄清楚我在哪里搞砸了。我已经通过这个程序 100 次,我仍然无法弄清楚为什么它没有运行。正在调用的数据库中的所有区域都不是空白的,并且所有变量都是从前一页正确带入的。
$host="localhost";
$username="root";
$password="sunbuggy";
$database="mpg";
$table="m";
mysql_connect($host,$username,$password) or die( "unable to connect to mysql server");
mysql_select_db($database) or die( "Unable to select database");
$driver=$_POST['driver'];
$shuttle=$_POST['shuttle'];
$gas=$_POST['gas'];
$miles=$_POST['miles'];
$cost=$_POST['cost'];
$getlastpri= "(SELECT * FROM '$table' ORDER BY `prikey` DESC)";
$sql=mysql_query($getlastpri);
$i=0;
$num=mysql_result($prime,$i,$prikey);
$shut=NULL;
while ($shut != $shuttle){
$shut=mysql_result($sql,$i,shuttle);
$i++;}
if($shut == $shuttle)
{$pastmiles=mysql_result($sql,$i,miles);}
else
$pastmiles=Null;
if($pastmiles=Null):
{$milestravled=Null;}
else:
$milestravled=$miles-$pastmiles;
$milespergallon=($milestravled/$gas);
$abc= "INSERT INTO $table VALUES ('','$driver','$shuttle','$gas','$miles','$cost', '$milestravled','$milespergallon')";
mysql_query($abc);
mysql_close();
echo "Your latest information has been input into the server";
?>`
提前非常感谢。亨利