Home  >  Article  >  Backend Development  >  mysql-foreach语句怎么就插入第一个数据

mysql-foreach语句怎么就插入第一个数据

WBOY
WBOYOriginal
2016-06-02 11:28:301386browse

mysqlphpforeach

<code> $cc = file_get_contents('data/phone_log.txt');$arrConts = explode("\n",$cc);foreach($arrConts as $ccc){$ccc = json_decode(stripslashes($ccc), true);...处理json插入数据库}</code>

mysql表的id是自增的,没有插入
$query = "INSERT INTO logs SET name='".$ccc[name]."',state=1,domain='".$domain."',data='".$new."'";
mysql_query($query);

<code> 打开文本获得json数组,然后处理,但是多行的时候每次只插入第一个数据</code>
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