1
jQuery & PHP를 사용하여 간단한 웹 사이트 히트 맵을 작성했습니다. 나는 그것을 작동하게 만들었지 만 지금은 WordPress에서 사용하고 싶습니다. 그리고 WordPress에서 작동하도록 Insert MYSQL 함수를 은밀히 처리하는 방법을 모색하고있었습니다. 내가 여기에 배열의 비트와 struggeling하고WordPress MySQL 변환 삽입
global $wpdb;
//$clicks = $_POST["clicks"];
$clicks = '.testimonial;1119;316;1663;608;#header;723;66;1663;608';
$keys = array('identifier_name', 'pos_x', 'pos_y','window_width','window_height');
$arr = explode(';', $clicks);
$data = array_chunk($arr, 5);
//Create an array of values for the insert statement
$values = array();
foreach ($data as $rec) {
$values[] = "(1, '" . join("', '", $rec) . "', 'ok')";
}
//Create a single insert statement with all the values
//I am trying to convert this Insert Function
$sql = "INSERT INTO data (user_id, " . join(', ', $keys) . ", status)";
$sql .= "VALUES " . implode(", ", $values);
echo $sql . '<br>';
:
$wpdb->insert(
$table,
array(
/* This is where I struggle */
)
);
어떤 도움이 많이 appreceated 아래의 예를 참조하십시오.