关于我之前的一个问题
我已经更改并使用了代码,但出现以下错误。
Query was emptyArray ( [imei] => 1 [serial] => 1 [status] => 1 [msisdn_no] => 0827910119
[card_no] => 89604900000001868482 [client_name] => 1 [inst_date] => 2013-09-10 [tech] => 1
[inst_cert] => 1 [isp] => Vodacom [account] => 1 [account_price] => 1 [deposit] => 1
[cont_start] => 1 [cont_end] => 1 [rica] => 1 [date_rica] => 1 [prod] => 1 [active] => 1
[suspended] => 1 [loaded_by] => 1 [send] => Submit ) : mysql err no : 1065 Your Number has
been registered and Location has been Captured. Please click here for your Map and
Location
这是我的更新 PHP 代码
//Drawn from Form Information used to Update Database
$imei = $_POST['imei'];
$serial = $_POST['serial'];
$status = $_POST['status'];
$msisdn_no = $_POST['msisdn_no'];
$card_no = $_POST['card_no'];
$client_name = $_POST['client_name'];
$inst_date = $_POST['inst_date'];
$tech = $_POST['tech'];
$inst_cert = $_POST['inst_cert'];
$isp = $_POST['isp'];
$account = $_POST['account'];
$account_price = $_POST['account_price'];
$deposit = $_POST['deposit'];
$cont_start = $_POST['cont_start'];
$cont_end = $_POST['cont_end'];
$rica = $_POST['rica'];
$date_rica = $_POST['date_rica'];
$prod = $_POST['prod'];
$suspended = $_POST['suspended'];
$loaded_by = $_POST['loaded_by'];
$id =$_POST['id'] ;
//update database
update_lbs($msisdn, $reqby1, $reqdate, $reqtime, $client, $clientcase, $saps, $cas,
$reason, $reqby, $long, $lat, $msisdn, $dist, $response);
//update database
function update_lbs($imei, $serial, $status, $msisdn_no, $card_no, $client_name,
$inst_date, $tech, $inst_cert, $isp, $account, $account_price, $deposit, $cont_start,
$cont_end, $rica, $date_rica, $prod, $suspended, $loaded_by)
{ global $host;
global $username;
global $password;
global $db_name;
date_default_timezone_set('Africa/Johannesburg');
$today = date("Y-m-d H:i:s");
$date = date("Y-m-d") ;
$time = date("H:i:s");
$insertSuccessful = false;
if ($con = mysql_connect($host, $username, $password)) {
if (mysql_select_db($db_name)) {
$query = "UPDATE tracking_sim SET
imei = '$imei',
serial = '$serial',
status = '$status',
msisdn_no = '$msisdn_no',
card_no = '$card_no',
client_name = '$client_name',
tech = '$tech',
inst_cert = '$inst_cert',
isp = '$isp',
account = '$account',
account_price = '$account_price',
deposit = '$deposit',
cont_start = '$cont_start',
cont_end = '$cont_end',
rica = '$rica',
date_rica = '$date_rica',
prod = '$prod',
date_rica = '$date_rica',
suspended = '$suspended',
loaded_by = '$loaded_by'
WHERE id = '$id';";
if (mysql_query($sql, $con)) {
$insertSuccessful = true;
} else {
echo mysql_error ();
echo $sql;
print_r($_POST);
echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
echo "mysql err no : " . mysql_errno($con);
}
return $insertSuccessful;
}
}
}
?>
我的表格有以下内容
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// get value of id that sent from address bar
$id = $_GET['id'];
$result = mysql_query("SELECT * FROM tracking_sim WHERE id='$id'");
$rows = mysql_fetch_array($result);
?>
<form id="form1" method="post" action="../control_tracking/tracking_sim_updated.php">
我已经尝试了带有 GET 和 POST 相同错误的表单操作,我也将 $_POST 更改为 $_REQUEST 并尝试了这种方式,但无济于事