Re: [PHP-DB] Extracting the essence!
Hi All. Thanx Lisi, it worked. But more to come. Have modified the code but, cant get the output i want. $test= preg_replace ($search, $replace, $dokument); while (list ($key, $val) = each($test)) { if ($key = 5 || $key == 6) { //do nothing } else { echo $key = $val[1],$val[2],$val[3],$val[4], nbsp; ,$val[5]; echo br br; } } Want to display the parsed tabel enteries in diferent ways. The table have dynamic updates and different lengths so I can't use the $val[x]. eg. one line reads before parsed: tr TD ALIGN=right1/TDDont want this entery to show. TDtest1test1/TD want to truncate this to the 5 first letters TDtest2/TDshow this TD9/TDTD3/TD show the sum 9+3 TD ALIGN=center68-33/TD show the sum 68-33 TD ALIGN=righttest3/TD show this /tr Regards Stan - Original Message - From: #Linux [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Lisi [EMAIL PROTECTED] Sent: Sunday, April 14, 2002 11:24 PM Subject: Re: [PHP-DB] Extracting the essence! Tanks so far, but if I want don't want to display the 1st and 4th line. - Original Message - From: Lisi [EMAIL PROTECTED] To: #Linux [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, April 14, 2002 10:55 PM Subject: Re: [PHP-DB] Extracting the essence! Try something like the following to extract the contents of the array by looping through it: $test= preg_replace ($search, $replace, $dokument); while (list ($key, $val) = each($test)) { echo $key = $val; } HTH -Lisi -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Extracting the essence!
How about: $test= preg_replace ($search, $replace, $dokument); while (list ($key, $val) = each($test)) { if ($key == 0 || $key == 3) { //do nothing } else { echo $key = $val; } } Let me know if this works. -Lisi At 11:24 PM 4/14/02 +0200, #Linux wrote: Tanks so far, but if I want don't want to display the 1st and 4th line. - Original Message - From: Lisi [EMAIL PROTECTED] To: #Linux [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, April 14, 2002 10:55 PM Subject: Re: [PHP-DB] Extracting the essence! Try something like the following to extract the contents of the array by looping through it: $test= preg_replace ($search, $replace, $dokument); while (list ($key, $val) = each($test)) { echo $key = $val; } HTH -Lisi -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Extracting the essence!
Hi ppl! I want to strip html sites from the tags, only leaving the data from a table entity. The info i would like to insert into a mysql table. Have tried to use the following code with various $dokument variables, but it dont preform as expected. ?php $dokument = file(http://localhost/php/index.html;); $search = array ('script[^]*?.*?/script'si, 'style[^]*?.*?/style'si, '[\/\!]*?[^]*?'si, '([\r\n])[\s]+', '(quot|#34);'i, '(amp|#38);'i, '(lt|#60);'i, '(gt|#62);'i, '(nbsp|#160);'i, '(iexcl|#161);'i, '(cent|#162);'i, '(pound|#163);'i, '(copy|#169);'i, '#(\d+);'e); $replace = array (, , \\1, \, , , , , chr(161), chr(162), chr(163), chr(169) //,chr(\\1) ); $test= preg_replace ($search, $replace, $dokument); echo $test; php? The output of this script comes as: Array Stan
Re: [PHP-DB] Extracting the essence!
Try something like the following to extract the contents of the array by looping through it: $test= preg_replace ($search, $replace, $dokument); while (list ($key, $val) = each($test)) { echo $key = $val; } HTH -Lisi -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Extracting the essence!
Tanks so far, but if I want don't want to display the 1st and 4th line. - Original Message - From: Lisi [EMAIL PROTECTED] To: #Linux [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, April 14, 2002 10:55 PM Subject: Re: [PHP-DB] Extracting the essence! Try something like the following to extract the contents of the array by looping through it: $test= preg_replace ($search, $replace, $dokument); while (list ($key, $val) = each($test)) { echo $key = $val; } HTH -Lisi -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php