Multi do Bizarro 15 Posted February 6, 2015 Erro: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Minion', 'Grito de Guerra: Cause 1 de dano.' , 'Horde', 'Common', '1', '1' at line 1 PHP: $connection = mysql_connect('localhost', 'root', '') or die(mysql_error()); $db = mysql_select_db('hstests', $connection) or die(mysql_error()); $json = file_get_contents('Basic.ptPT.json'); $bases = json_decode($json, true); if(isset($_POST['GO'])){ $i = 1; for (; ; ) { if ($i > 209) { break; } if(isset($bases[$i]['name']) && isset($bases[$i]['id']) && $bases[$i]['type']=='Minion'){ $nome = utf8_decode($bases[$i]['name']); $id = $bases[$i]['id']; $tipo = $bases[$i]['type']; if(isset($bases[$i]['text'])){ $texto = utf8_decode($bases[$i]['text']); } if(isset($bases[$i]['faction'])){ $fact = $bases[$i]['faction']; } $rare = utf8_decode($bases[$i]['rarity']); //Numeros $custo = $bases[$i]['cost']; $ataq = $bases[$i]['attack']; $health= $bases[$i]['health']; if(isset($texto)){$asd = ", `texto`";$asdad=", '".$texto."'";}; if(isset($fact)) {$asda = ", `fact`";$asdas=", '".$fact."'";}; mysql_query("INSERT INTO `unstable` (`nome`, `cardid`, `tipo`".$asd." ".$asda.", `rare`, `cost`, `att`, `hp`) VALUES ('".$nome."', '".$id.", '".$tipo."'".$asdad." ".$asdas.", '".$rare."', '".$custo."', '".$ataq."', '".$health."')") or die(mysql_error()); } $i++; } } Share this post Link to post Share on other sites
TMoore 217 Posted February 6, 2015 Utiliza mysqli ou PDO, recuso.me a ajudar com o MySQL, mais do que ultrapassado. Share this post Link to post Share on other sites