Home > Backend Development > PHP Tutorial > discuz中为啥这样打不出来呢

discuz中为啥这样打不出来呢

WBOY
Release: 2016-06-23 13:48:38
Original
823 people have browsed it

用的是DB::函数,代码如下:

<?php/** *      [Discuz!] (C)2001-2099 Comsenz Inc. *      This is NOT a freeware, use is subject to license terms * *      $Id: forum.php 33828 2013-08-20 02:29:32Z nemohou $ */define('APPTYPEID', 88);define('CURSCRIPT', 'test');require './source/class/class_core.php';require './source/function/function_forum.php';C::app()->init();$squery=DB::query("SELECT catname FROM".DB::table('portal_category'));  while($value=DB::fetch($squery)){	$data[]=$value;}print_r($data);?>
Copy after login

显示是下图,不知为啥提示说没有这个字段,但明明是有的啊


回复讨论(解决方案)

SELECT catname FROMportal_category
FROM 和 portal_category 粘在一起了

$squery=DB::query("SELECT catname FROM ".DB::table('portal_category'));  
Copy after login

你太粗心了,能先检查一下么...

你太粗心了,能先检查一下么...


其实不是粗心的事,是用错了函数了.换一个就可以了.

呵呵,还是粗心的问题,其实也不是,from 后面必须要有一个空格,晕!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template