View Single Post
Old 12-15-2009, 10:46 PM  
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
hmm i got this to separate the thing into 15 arrays, 5 per message,

Code:
<?php
include 'dbconnect.php';

$query  = "SELECT * FROM messages WHERE id=43";
$result = mysql_query($query);


while($row = mysql_fetch_array($result))
  {
  $str = $row['message'];
}

$arrays = explode(',', $str);
print_r($arrays)."<hr />";

//mysql_query($connect);

	  
foreach($arrays as $value){
$i = 0;
print_r($value)."<hr />";


   for($i=0; $i < count($value); $i++) {
     $new = explode(',',$value);
         echo $new[0]. "|" .$new[1]."|".$new[2]."|".$new[3]."|".$new[4]."|".$new[5]."<br />";


	  }

}	  
?>
doesn't seem to work with the insert command

Code:
  $sql = "INSERT INTO modem2   ('zero','one','two','three','four','five') VALUES (".$new[0].",".$new[1].",".$new[2].",".$new[3].",".$new[4].","$new[5].")";
had to modify it a bit to get it working.
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote