callingrohit Posted January 1, 2007 Share Posted January 1, 2007 Hi everyone,I have a form with checkbox input and the data is stored into a MYSQL table. So I serialize this checkbox data before inserting it into the database. Now I also export the data with a click of a button into a spreadsheet. The data in the mysql table looks like this [b]a:3:{i:0;s:3:"uno";i:1;s:3:"dos";i:2;s:4:"tres";}[/b]I was wondering if its possible to modify the above data to just [b]uno,dos,tres[/b] and then insert it into my excel table.Thankscheersrohit Quote Link to comment Share on other sites More sharing options...
trq Posted January 1, 2007 Share Posted January 1, 2007 Not very pretty but...[code]#!/usr/bin/php<?php $line = 'a:3:{i:0;s:3:"uno";i:1;s:3:"dos";i:2;s:4:"tres";}'; $arr = explode('"',$line); $newstring = $arr[1].','.$arr[3].','.$arr[5]; echo $newstring;?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.