Home>Article>Database> How to store json data in php to mysql?

How to store json data in php to mysql?

little bottle
little bottle Original
2019-05-09 15:43:19 7855browse

I saw some netizens saying that using PHP is a suitable solution to save Qujiang json data into mysql. I would like to ask how to save json format data into mysql.

How to store json data in php to mysql?

If you want to store json data in PHP into a mysql database, you must first use PHP to serialize and filter it, and then store it in the database

The specific code is as follows:

$data = json_encode($array);// 过滤 $data = addslashes($data);// 入库 $db->insert( $table_name,array( 'field' => $data, ));

The above is the detailed content of How to store json data in php to mysql?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to use MySQL Workbench Next article:How to use MySQL Workbench