如何从 DB 中获取此值作为字符串或 int?
PHPMyAdmin http://img200.imageshack.us/img200/6388/gr55.jpg
我试过这个:
$var = $this->db->query("SELECT SUBSTRING(`category_id`, 1, 3)
AS `category_id` FROM " . DB_PREFIX . "category
WHERE merlion_id = 'Q1'
ORDER BY category_id ASC");
然后我检查了它var_dump
并收到了这个:
var_dump($var);
object(stdClass)#26 (3) { ["row"]=> array(1) { ["category_id"]=> string(3) "859" } ["rows"]=> array(1) { [0]=> array(1) { ["category_id"]=> string(3) "859" } } ["num_rows"]=> int(1) }