Sunday, April 27, 2008

Problems with data in query (2 replies)

OK, so i'm trying to use php an mySQL to convert a tab delimited file, so that when the converted file is setup it'll have basically the same data just in a different order. The problem i'm having is in importing the data to the database i get a weird error.

$sql = "INSERT INTO dsdi VALUES ('$DSDI_SKU', '$MODEL', '$STATUS',
'$MANUFACTURERS_NAME', '$PRODUCT_IMAGE', '$YOUR_PRICE',
'$MSRP', '$QUANTITY', '$WEIGHT', '$MAP', '$MAP_PRICE',
'$Ship_Method', '$Ship_Price', '$Ship_ETA',
'$PRODUCT_ADDED', '$CATEGORY', '$MASTER_CATEGORY',
'$PRODUCT_NAME', '$IMAGES_PATH', '$QUICK_SHIP',
'$PRODUCT_ID', '$PRODUCT_DESCRIPTION')";

$result = mysql_query($sql);

if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
}
else {
$message = 'Whole query: ' . $query . "/n";
}
echo $message . "<br><br>";


echo $PRODUCT_NAME . "<br><br>";
}


but heres the error i get.

Invalid query: 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 't that bad either, with a 4-way, 7-driver build system that features five midr' at line 7


now the "'t that bad either, with a 4-way, 7-driver build system that features five midr'" is data from my file, but there seems not to be any tab or new line characters near this area in my data.

Any help is appreciated.