File: C:/xampp/htdocs/myapi/delSqlData.php
<?php
// Assuming your PHP script interacts with a database or performs some other logic to generate data
// For this example, let's assume it generates a simple JSON response
// Sample data for demonstration purposes
$company=$_GET['Co'];
$po=$_GET['po'];
//echo "getCo:".$getCo."_".$getPo;
$servername = "127.0.0.1";
$username = "root";
$password = "fredsql";
$DBNAME = "tvicheck-st";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//echo "Connected successfully";
if( !mysqli_select_db($conn, $DBNAME)) {
die ("無法選擇資料庫");
}
mysqli_query( $conn, "SET NAMES 'utf8'");
$querys = "delete from spotreport where (po='$po' and company='$company') ";
//echo $querys;
$result = mysqli_query($conn, $querys);
$jsonData = json_encode($data);
// Set the response header to indicate that the content is JSON
//header('Content-Type: application/json');
// Output the JSON data
echo json_encode(array('message' => 'job id delete!'));
$conn->close();
?>