php数据库连接异常
Jun 13, 2016 pm 12:09 PM
php数据库连接错误
有代码如下:
$catid=intval($_REQUEST['catid']);
$sql_store = 'SELECT * FROM ecm_gcategory Where cate_id=$catid ORDER BY cate_id';
$my_category= DB::fetch_all($sql_store);
运行报如下错误:
SELECT * FROM ecm_gcategory Where cate_id=$catid ORDER BY cate_id
怎么解决哟?请高人指点!
------解决思路----------------------
$sql_store = "SELECT * FROM ecm_gcategory Where cate_id=$catid ORDER BY cate_id";
双引号!
------解决思路----------------------
单引号里面的变量不能被解析,需用双引号括起来。或者改成下面这样:
$sql_store = 'SELECT * FROM ecm_gcategory Where cate_id='.$catid.' ORDER BY cate_id';

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Solution: Your organization requires you to change your PIN

How to adjust window border settings on Windows 11: Change color and size

How to change title bar color on Windows 11?

How to enable or disable taskbar thumbnail previews on Windows 11

OOBELANGUAGE Error Problems in Windows 11/10 Repair

10 Ways to Adjust Brightness on Windows 11

How to turn off private browsing authentication for iPhone in Safari?
