i've got quite a bit of text in the $proginfo array
this code prints it out on the screen just fine -
the result of that above code is herePHP Code:// ....more php code here
foreach($proginfo[1] as $key => $val) {
echo ($key)+1;
?>
<textarea rows="1" cols="15"><?php print $proginfo[1][$key]; ?></textarea>
<textarea rows="2" cols="30"><?php print $proginfo[2][$key]; ?></textarea>
<textarea rows="10" cols="60"><?php print $proginfo[3][$key]; ?></textarea> <br>
<?php
}
// more php code here...
fine. great.
but using exactly the same sort of loop with exactly the same information in the array, but this time adding the data into a database table rather than outputting to screen, i end up with only 20 lines of results in the database table when infact there are 39 rows of data
this is the code i'm using to add the array data to the table -
for instance, rows 1,2,3 (refering to the numbers from the above page link) get added fine, but then rows 4,5,6,7 dissappear, then row 8 gets included in the database but then row 9 gets missed out. then 10, 11, 12 get included and so on. so nearly half of the rows get missed out.PHP Code:$db = mysql_connect ("localhost", "xxxxxxx", "xxxxxxx") or die ('I cannot connect to the database.');
mysql_select_db("xxxxxxxxxxxx",$db);
foreach($proginfo[1] as $key => $val) {
$sql="INSERT INTO $tablename (gmttime,programme,description) VALUES ('{$proginfo[1][$key]}','{$proginfo[2][$key]}','{$proginfo[3][$key]}')";
$result = mysql_query($sql);
}
the actual data itself came originally from an html document, had the html stripped out of it with strip_tags then a regular expression to split it up into the array.
this is the table description incase that helps -
any ideas why some rows are getting missed and others aren't?PHP Code:mysql_query("CREATE TABLE $tablename (
id tinyint(3) unsigned NOT NULL auto_increment,
gmttime varchar(6) NOT NULL default '',
programme varchar(60) NOT NULL default '',
description longblob NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");



)
Bookmarks