i cloned a piece of sql code embedded into a php file.

the original works, however the clone generates the following error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource


code is identical:

$SQL = "SELECT * FROM ProductInfo WHERE ProductName=$DataKey ORDER BY ProductName";
$result = mysql_query($SQL, $GLOBALS[link]);
while ($AP = mysql_fetch_array($result)) {
include('productinfoformdata.php');
}

key is passed via url, retrieves ok.

what am i doing wrong ?