这是我插入其工作时的代码,但在比较时显示解析语法错误
// attempt insert query execution
$sql = "INSERT INTO availer (source_name, dstntn_name, sou_date, flight_no, sou_weight, contact_name, contact_no) VALUES ('$source_name', '$dstntn_name', '$sou_date', '$flight_no', '$sou_weight', '$contact_name', '$contact_no')";
if(mysqli_query($link, $sql)){
$sql ="SELECT availer.id, availer.source_name,availer.dstntnn_name,availer.sou_date,availer.sou_weight FROM availer availer
WHERE EXISTS (SELECT * FROM provider provider
WHERE provider.source_name = availer.source_name AND provider.dstntn_name = availer.dstntn_name AND provider.sou_date = availer.sou_date AND provider.flight_no = availer.flight_no");
print $query;
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
答案 0 :(得分:0)
您错过了 $sql = "INSERT INTO availer (source_name, dstntn_name, sou_date, flight_no, sou_weight, contact_name, contact_no) VALUES ('$source_name', '$dstntn_name', '$sou_date', '$flight_no', '$sou_weight', '$contact_name', '$contact_no')";
if(mysqli_query($link, $sql)){
$sql ="SELECT availer.id, availer.source_name,availer.dstntnn_name,availer.sou_date,availer.sou_weight FROM availer availer
WHERE EXISTS (SELECT * FROM provider provider
WHERE provider.source_name = availer.source_name AND provider.dstntn_name = availer.dstntn_name AND provider.sou_date = availer.sou_date AND provider.flight_no = availer.flight_no)";
print $query;
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
标记。你的代码应该是这样的。
using OutLook = Microsoft.Office.Interop.Outlook;
OutLook.Application outlookObj;
OutLook.NameSpace olintNS;
OutLook.MailItem mailitem;
mailitem = outlookObj.CreateItem(OutLook.OlItemType.olMailItem);
答案 1 :(得分:0)
<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
$link = mysqli_connect("localhost", "root", "", "prog_db");
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
// Escape user inputs for security
$source_name = mysqli_real_escape_string($link, (isset($_POST['source'])));
$dstntn_name = mysqli_real_escape_string($link,(isset($_POST['dstntn'])));
$sou_date = mysqli_real_escape_string($link,(isset($_POST['date'])));
$flight_no = mysqli_real_escape_string($link,(isset($_POST['flightno'])));
$sou_weight = mysqli_real_escape_string($link,(isset($_POST['weight'])));
$contact_name = mysqli_real_escape_string($link,(isset($_POST['name'])));
$contact_no = mysqli_real_escape_string($link,(isset($_POST['contact'])));
// attempt insert query execution
$sql = "INSERT INTO availer (source_name, dstntn_name, sou_date, flight_no, sou_weight, contact_name, contact_no) VALUES ('$source_name', '$dstntn_name', '$sou_date', '$flight_no', '$sou_weight', '$contact_name', '$contact_no')";
if(mysqli_query($link, $sql)){ $sql ="SELECT availer.id, availer.source_name,availer.dstntnn_name,availer.sou_date,availer.sou_weight FROM availer availer
WHERE EXISTS (SELECT * FROM provider provider
WHERE provider.source_name = availer.source_name AND provider.dstntn_name = availer.dstntn_name AND provider.sou_date = availer.sou_date AND provider.flight_no = availer.flight_no)";
$result = mysql_query($sql,$link);
while($row = mysql_fetch_array($result)) {
echo $row['SOURCE_name'];
}
}
else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
// close connection
mysqli_close($link);
but i am not able to fatch the result on the webpage .
答案 2 :(得分:0)
你应该写这个
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
if (isset ($_POST['source'], $_POST['dstntn'], $_POST['date'], $_POST['flightno'],$_POST['weight'],$_POST['name'], $_POST['contact'])){
$source_name = mysqli_real_escape_string($link,$_POST['source']);
$dstntn_name = mysqli_real_escape_string($link,$_POST['dstntn']);
$sou_date = mysqli_real_escape_string($link,$_POST['date']);
$flight_no = mysqli_real_escape_string($link,$_POST['flightno']);
$sou_weight = mysqli_real_escape_string($link,$_POST['weight']);
$contact_name = mysqli_real_escape_string($link,$_POST['name']);
$contact_no = mysqli_real_escape_string($link,$_POST['contact']);
// attempt insert query execution
$sql = "INSERT INTO availer (source_name, dstntn_name, sou_date, flight_no, sou_weight, contact_name, contact_no) VALUES ('$source_name', '$dstntn_name', '$sou_date', '$flight_no', '$sou_weight', '$contact_name', '$contact_no')";
if(mysqli_query($link, $sql)){ $sql ="SELECT availer.id, availer.source_name,availer.dstntnn_name,availer.sou_date,availer.sou_weight FROM availer availer
WHERE EXISTS (SELECT * FROM provider provider
WHERE provider.source_name = availer.source_name AND provider.dstntn_name = availer.dstntn_name AND provider.sou_date = availer.sou_date AND provider.flight_no = availer.flight_no)";
$result = mysql_query($sql,$link);
while($row = mysql_fetch_array($result)) {
echo $row['SOURCE_name'];
}
}
else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
}
// close connection
mysqli_close($link);