単純な挿入クエリが機能しない理由を理解するのに助けが必要です。
以下のコード:
<?php
// db info
define ( 'DB_HOST', '' );`enter code here`
define ( 'DB_USER', '' );
define ( 'DB_PASSWORD', '' );
define ( 'DB_NAME', '' );
create_db_connection ();
function create_db_connection() {
global $con;
$con = mysql_connect ( DB_HOST, DB_USER, DB_PASSWORD ) or die ( "connection not established" );
$db = mysql_select_db ( DB_NAME, $con ) or die ( "database not connected" );
}
$sql= "insert into 'tbl_BonAproval' (OrderId,RestId) values (20001,98765)";
if (mysqli_query ( $db, $sql )) {
echo "Successfully inserted " . mysqli_affected_rows ( $db ) . " row";
} else {
echo "Error occurred: " . mysqli_error ( $db );
}
function close_mysql_connection() {
global $con;
mysql_close ( $con );
}
$result = mysql_query ( "SELECT * FROM `tbl_BonAproval`" );
$row = mysql_fetch_array ( $result );
print_r ( $row ); // print array
echo $row ['table field name']; // print field data
// $sql=mysql_query('INSERT INTO tbl_BonAproval (OrderId, RestId) VALUES (24553, 01001);');
// echo $sql;
mysql_close ( $conn );
class CallBack {
}
?>