PHPEXCEL import error



  • There's a PHPEXCEL code, followed by a bud, it's somehow not met.

    <?php
    require_once("simple_html_dom.php");
    $db = mysql_connect("localhost","root","");
    mysql_select_db("parser",$db);
    $html = file_get_html("http://localhost");
    foreach($html->find("tr") as $row) {
        $td = $row->find("td");
        mysql_query("INSERT INTO `tableasd`(`title`, `articul`, `category`) VALUES ({$td[1]},{$td[2]},{$td[3]})");
    }
    ?>
    

    VAR_DUMP asks NULL how to make this violin work?



  • Found a mistake, changed the code. In the end, the code looks like this. Parser works.

    <?php
    require_once("simple_html_dom.php");
    $db = mysql_connect("localhost","root","");
    mysql_select_db("parser",$db);
    $html = file_get_html("http://localhost");
    foreach($html->find("tr") as $row) {
        $td = $row->find("td");
        $category = $td[1];
        $title = $td[2];
        $articul = $td[3];
        mysql_query("SET NAMES utf8");
        mysql_query("INSERT INTO `tableasd`(`title`, `articul`, `category`) VALUES ('{$title}','{$articul}','{$category}')");
    }
    ?>
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2