dt614037527
dt614037527
2015-03-14 11:18

将PHP数组存储到mySQL

I am trying to store some PHP arrays that come from a XML API servce into a MYSQL DB, and clear them on the session is closed or a new search is made

Have any ideea if this can be posible?

My Variables are $img[][], $name[] and $product[]->type[]->Category; and a unique variable:$searchID`

My final purpose is to store them into mySQL DB so i can create pagination system

Any advise will be much appreciated..

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dongyin2390 dongyin2390 6年前
    $st=$db->prepare("INSERT INTO `table` (`img`,`name`,`Category`,`searchID`) VALUES(?,?,?,?)");
    $st->execute($img[x][x],$name[x],$product[x]->type[x]->Category,$searchID);
    

    ? maybe serialize() / json_encode it if its not basic variables

    点赞 评论 复制链接分享