dflow Posted December 22, 2010 Share Posted December 22, 2010 strange :confused: i want to update ProductDescription i get the parsed $pdescription it is echoed but it's regarded as empty by var_dump <?php // example of how to use basic selector to retrieve HTML contents include('../simple_html_dom.php'); $links=array("http://www.example.com/apartments/198.htm"); foreach($links as $page) { $phtml = file_get_html($page); // find all td tags with attribite align=center foreach($phtml->find('span[id=lblCodiceAppartamento]') as $name){ echo $name->plaintext.'<br><br>'; } foreach($phtml->find('span[id=lblDescrizione]') as $pdescription){ echo $pdescription.'<br><br>'; } $con = mysql_connect("localhost","root","root"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("international", $con); $query=mysql_query("UPDATE products_NEW SET ProductDescription='$pdescription' WHERE ProductName = '$name->plaintext' AND SupplierID = '38'"); var_dump($query); //mysql_query("INSERT INTO apartments (name) //VALUES ('$name->plaintext')"); mysql_close($con); } Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted December 22, 2010 Share Posted December 22, 2010 your query (if it works) is an update query. what do you expect to be returned from an update query? $sql = "UPDATE products_NEW SET ProductDescription='$pdescription' WHERE ProductName = '$name->plaintext' AND SupplierID = '38'"; $result = mysql_query($sql) or die(mysql_error() ." IN $sql"); Quote Link to comment Share on other sites More sharing options...
dflow Posted December 22, 2010 Author Share Posted December 22, 2010 i figured it out i forgot to addslashes to the parsed description before the update query so it wasnt updating the productdescription field and returned false addslashes did the trick Quote Link to comment Share on other sites More sharing options...
requinix Posted December 22, 2010 Share Posted December 22, 2010 your query (if it works) is an update query. what do you expect to be returned from an update query? bool(true)? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.