Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我收到 Notice: Use of undefined constant num - assumed 'num'我的代码所遵循的错误
Notice: Use of undefined constant num - assumed 'num'
$query = "SELECT COUNT(*) AS num FROM $tableName"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num];
如何解决这个问题?
我没有合适的头衔,所以请不要把它改成合适的
@AkhileshBChandran 给出了一个正确的解决方案。将来,如果您要引用该列,则需要将其放在引号中。
$total_pages = $total_pages['num'];
$total_pages = $total_pages[0];