Php 为什么mysql_查询(显示表状态类似)会获取自动_增量值的空值
该表的定义如下:Php 为什么mysql_查询(显示表状态类似)会获取自动_增量值的空值,php,auto-increment,Php,Auto Increment,该表的定义如下: CREATE TABLE `oc_product_option_value` ( `product_option_value_id` int(11) NOT NULL AUTO_INCREMENT, `product_option_id` int(11) NOT NULL, `product_id` int(11) NOT NULL, `option_id` int(11) NOT NULL, `option_valu
CREATE TABLE `oc_product_option_value` (
`product_option_value_id` int(11) NOT NULL AUTO_INCREMENT,
`product_option_id` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`option_id` int(11) NOT NULL,
`option_value_id` int(11) NOT NULL,
...
)
PHP代码如下所示:
...
$res = mysql_query("SHOW TABLE STATUS LIKE '%product_option_value'");
//$res = mysq_query("SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_NAME = 'product_option_value'");
$row = mysql_fetch_assoc($res);
$n_id = is_null( $row['Auto_increment']) ? 'null' : $row['Auto_increment'] ;
...
嗯,我总是得到一个空值?从哪里运行代码?也许您没有特权或被服务器禁止?var_dump$row给了您什么?在前端(如phpMyAdmin或类似)上运行完全相同的查询会得到什么结果?