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

discuz中为啥这样打不出来呢

WBOY
WBOYOriginal
2016-06-23 13:48:38824browse

用的是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);?>

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


回复讨论(解决方案)

SELECT catname  FROMportal_category
FROM 和 portal_category 粘在一起了

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

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

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


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

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

Statement:
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