PHP:使用数组[MySQL][PHP][Array][Insert]将数据插入MySQL表
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP:使用数组[MySQL][PHP][Array][Insert]将数据插入MySQL表相关的知识,希望对你有一定的参考价值。
Inserts the values of an array into a table. Also supports specifying if a specific field needs to be encoded using PASSWORD()Parameters:
Table: Name of table to insert into
Data: array of $field->$value of new data
Password Field: Which field in the data array needs to be surrounded with PASSWORD() (optional)
foreach ($data as $field=>$value) { $fields[] = '`' . $field . '`'; if ($field == $password_field) { } else { } } $query = "INSERT INTO `" . $table . "` (" . $field_list . ") VALUES (" . $value_list . ")"; return $query; }
以上是关于PHP:使用数组[MySQL][PHP][Array][Insert]将数据插入MySQL表的主要内容,如果未能解决你的问题,请参考以下文章