php - How to Store the Parsed Values in Data base? -


i parsed matches page:

$html = file_get_html('http://www.espncricinfo.com/rankings/content/current/page/211271.html'); $es = $html->find('table td[class=left]'); 

if print values:

echo "matches: $es[37]"; 

its working fine:

matches: 48 

i want store value in data base:

update table set column1=($es[37]) column2='123'; 

its not working. if data type int storing '0' , if data type varchar, storing table td[class=left].

how can store this??

you should use outertext value of td.

what want is:

update table set column1=($es[37]->outertext) column2='123'; 

you can see example of in http://simplehtmldom.sourceforge.net/manual.htm under "how access html element's attributes?" "tips".

what you're doing accessing whole object , want value of text in html element (that's outertext comes in).

in instances might want go further in php , convert string integer, think mysql in case.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -