0

我是 PHP 新手,在第 25 行收到消息 Parse error: syntax error, unexpected T_VARIABLE in ..。如果有人能帮助我解决这个错误,我将不胜感激,因为它真的开始让我感到压力。一直在dreamweaver上,它说错误,它说 $Username=... 但我似乎无法修复它

<?php
    $host="******"; // Host name 
    $username="******"; // Mysql username 
    $password="******"; // Mysql password 
    $db_name="******"; // Database name 
    $tbl_name="avaya"; // Table name

    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB");


    $con = mysql_connect("localhost","root","");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    mysql_select_db("inventory", $con);


    $addavaya="INSERT INTO avaya_pabx(critical_spare_id, serial_no, ,comcode, version, circuit_pack, classification, location, availability, date, client)
    VALUES ('". $_POST['critical_spare_id'] . "', '" . $_POST['serial_no']. "', '". $_POST['comcode'] . "','". $_POST['version'] . "','". $_POST['circuitp_pack'] . "','". $_POST['classification'] . "','". $_POST['location'] . "', '". $_POST['availability'] . "', '". $_POST['date'] . "', '". $_POST['client'] . "')";

    mysql_query($addavaya,$con)

    if (!mysql_query($addavaya,$con))
      {
      die('Error: ' . mysql_error());
      }
    echo "1 record added";

    mysql_close($con);

    ?>
4

1 回答 1

2

您在这一行的末尾缺少一个分号:

mysql_query($addavaya,$con)
于 2012-04-30T03:14:05.827 回答