mysql_connect('localhost:3036', 'x', 'x');
mysql_select_db('extractor');
$baseSKUraw = mysql_query("SELECT * FROM product_category where tier_one='".$result1."' and tier_two ='".$result2."' ");
$baseSKU = mysql_fetch_array($baseSKUraw);
echo json_encode(array("error"=>0, "result1"=>$baseSKU['sku_base']));
Json 正在返回{"error":0,"result1":null}
,但是当我执行时,"result1"=>"texthere"
它会相应地返回到我的文本框。
- 这里出了什么问题,我似乎无法显示
sku_base
? - 我应该什么时候使用
mysql_fetch_array
?因为我现在只返回 1 个结果?
var_dump(baseSKUraw);
resource(3) of type (mysql result)
{"error":0,"result1":null}
print_r($baseSKU);
resource(3) of type (mysql result)
Array
(
[0] => 1
[id] => 1
[1] => Tops
[tier_one] => Tops
[2] => Shortsleeve
[tier_two] => Shortsleeve
[3] => WTSS
[sku_base] => WTSS
)