0

我尝试在CS-Cart. 但这对我不起作用。

$category_id = 1;

$company = db_get_array(SELECT `company_id`,`lang_code`,`email`,`phone`,`address`,`city`,`state`,`country`,`zipcode`,`logos`,`company`,`timestamp`,`status`,`opening_hours` FROM `cscart_companies` WHERE `categories` LIKE '$category_id,%' OR `categories` LIKE '%,$category_id,%' OR `categories` LIKE '%,$category_id' OR `categories`='$category_id');

以上是我从数据库查询的代码,但它不起作用。

4

1 回答 1

0

首先尝试像这样正确的查询格式(你的引号很乱):

$company = db_get_array("SELECT company_id, lang_code, email, phone, address, city, state, country, zipcode, logos, company, timestamp, FROM WHERE LIKE '".$category_id.",%' OR statusLIKE '%,".$category_id.",%' OR LIKE ' %,".$category_id."' OR ='".$category_id."'");opening_hourscscart_companiescategoriescategoriescategoriescategories

如果这不起作用,请在此处发布错误。

但我建议对数据库查询使用占位符:请参阅文档:http ://docs.cs-cart.com/4.2.x/core/db/placeholders.html

于 2014-10-23T14:46:01.720 回答