You are here:  » Empty field table after Parsing


Empty field table after Parsing

Submitted by jonnen on Fri, 2012-05-18 01:57 in

Hello,

Thanks for the code.
unfortunatly when I try to run my parse.
All fields of my table still empty.
Could you help me?

this is the code:

<?php
error_reporting
(E_ERROR);
require(
'MagicParser.php');
$conn mysql_connect('mxxxxx''xxxxxxxx''xxxxxx') or die("Database
connection failed"
);
mysql_select_db("xxxxxxx2",$conn);
$sql "TRUNCATE xxxxx2";
function 
myRecordHandler($record)
{
global 
$conn;
$sql "INSERT INTO xxxxxx2 SET
idproduit = '"
.mysql_escape_string($record["idproduit"])."',
codearticle = '"
.mysql_escape_string($record["codearticle"])."',
codebarre = '"
.mysql_escape_string($record["codebarre"])."',
reffournisseur = '"
.mysql_escape_string($record["reffournisseur"])."',
nomfournisseur = '"
.mysql_escape_string($record["nomfournisseur"])."',
nomproduit = '"
.mysql_escape_string($record["nomproduit"])."',
etat = '"
.mysql_escape_string($record["etat"])."',
categorie = '"
.mysql_escape_string($record["categorie"])."',
souscategorie = '"
.mysql_escape_string($record["souscategorie"])."',
souscategorie2 = '"
.mysql_escape_string($record["souscategorie2"])."',
souscategorie3 = '"
.mysql_escape_string($record["souscategorie3"])."',
attributs = '"
.mysql_escape_string($record["attributs"])."',
themes = '"
.mysql_escape_string($record["themes"])."',
soldes = '"
.mysql_escape_string($record["soldes"])."',
prix_reference = '"
.mysql_escape_string($record["prix_reference"])."',
pourcentage_solde =
'"
.mysql_escape_string($record["pourcentage_solde"])."',
prix = '"
.mysql_escape_string($record["prix "])."',
urlficheproduit = '"
.mysql_escape_string($record["urlficheproduit"])."',
urlimage = '"
.mysql_escape_string($record["urlimage"])."',
urlimageoriginal = '"
.mysql_escape_string($record["urlimageoriginal"])."',
genre = '"
.mysql_escape_string($record["genre"])."',
realisateur = '"
.mysql_escape_string($record["realisateur"])."',
acteurs = '"
.mysql_escape_string($record["acteurs"])."',
interprete = '"
.mysql_escape_string($record["interprete"])."',
editeur = '"
.mysql_escape_string($record["editeur"])."',
descriptif = '"
.mysql_escape_string($record["descriptif"])."',
disponibilite = '"
.mysql_escape_string($record["disponibilite"])."',
dateexpedition = '"
.mysql_escape_string($record["dateexpedition"])."',
fraisdeport = '"
.mysql_escape_string($record["fraisdeport"])."',
isbn = '"
.mysql_escape_string($record["isbn"])."',
TOP100 = '"
.mysql_escape_string($record["TOP100 "])."'
"
;
mysql_query($sql,$conn);
// Debugging
print mysql_error();
print 
"<br />";
}
// Insert Xml feed link
$url =
"{link saved}";
MagicParser_parse("$url","myRecordHandler","xml|produits/produit/");
?>

XML

{code saved}
Thanks

Julien

Submitted by support on Fri, 2012-05-18 07:04

Hello Julien,

As your feed is XML, the keys in $record will all be UPPERCASE, so for example in place of

idproduit = '".mysql_escape_string($record["IDPRODUIT"])."',

I see that you already have mysql_error() debug output in place so if the SQL being constructed is not compatible with your table that should indicate the problem...

Hope this helps!
Cheers,
David
--
MagicParser.com