Go Back   HTMLCenter Web Development Forums > Web Design and Development > Programming and Scripting

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 07-20-2008, 03:06 PM
Registered User
 
Join Date: Jul 2004
Posts: 224
preg_match? how to read within the td tags

I have a table in html which I need to convert to a database table for MySQL (I use HeidiSQL).
SO there are a few td tags and then a tr tag indicating a new record. How would I be able to insert them in the db table? DO I use preg_match? How would it be written.
PHP Code:
preg_match_all('|id="(.*)">|U'$contents_of_page$idoutPREG_SET_ORDER); 
    
preg_match_all("|<[^>]+>(.*)</[^>]+>|U"$contents_of_page$outPREG_SET_ORDER); 
Reply With Quote

  #2 (permalink)  
Old 07-22-2008, 03:22 PM
Registered User
 
Join Date: Jul 2004
Posts: 224
I need the preg_match innerHTML of <td></td>.
Reply With Quote
  #3 (permalink)  
Old 07-22-2008, 07:44 PM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,400
Regexps are not my strong suit, but I'll give it a shot:
PHP Code:
preg_match_all('#<td[^>]*?>(.*?)<\/td>#',$contents_of_page,$idout,PREG_SET_ORDER); 
If the opening and closing tag (and all of the information in between the two) are not always going to be on the same line, you will need to add the "s" modifier to make the regex read the whole input as a single line.
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read Oracle View Into MySQL curtiss Databases 3 06-14-2008 08:32 PM
Force a menu button to read text file (not cached) Bad Inferno Programming and Scripting 1 06-21-2007 08:41 AM
HELP!Please do read:) allyz94 Programming and Scripting 11 04-20-2007 04:50 PM
RULES: Please Read First! Allen New Member Introductions 0 08-16-2006 10:19 AM
Replacing a field separator during a read. NevadaSam Programming and Scripting 2 04-29-2006 01:53 PM


All times are GMT -5. The time now is 01:26 AM.

 
KickApps
Clicky Web Analytics


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
© 1997-2007 HTMLCenter