Code: Select all
<?php
$romancartxml = $_POST['romancartxml'];
$count = preg_match("/[\<]primarystockremaining[\>](.*)[\<]\/primarystockremaining[\>]/s", "$romancartxml", $primarystockremaining);
$count = preg_match("/[\<]item-code[\>](.*)[\<]\/item-code[\>]/s", "$romancartxml", $itemcode);
$primarystockremaining = $primarystockremaining[0];
$itemcode = $itemcode[0];
echo "Processing $itemcode, $primarystockremaining";
include "dbconn.php";
$result = mysql_query ("SELECT id, romancode, players FROM events WHERE romancode = '$itemcode'") or die(mysql_error());
$num_result = mysql_num_rows($result);
echo "$num_result for $itemcode";
while ($row = mysql_fetch_object($result))
{
} mysql_free_result($result);
mysql_close($sqlconn);
echo "<br/>$itemcode";
?>
Apologies for the extra code at the bottom, but this is odd. $itemcode echos perfectly. And if I force $itemcode = "070313-19";, then this query pulls up a result of 1. Which is correct.
But if I just query it like this, it pulls up nothing.
I know there is a way to kind of "see" the query, to know if it is putting the itemcode into the query correctly, but don't know how. It's really bizarre. I thought this would be the easy bit!