亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

使用php yii 框架,第一次用php代碼查詢Mysql中的表后,修改php代碼,想要查詢另一張表,可為什么每次都查詢剛才查詢過的那張表??

使用php yii 框架,第一次用php代碼查詢Mysql中的表后,修改php代碼,想要查詢另一張表,可為什么每次都查詢剛才查詢過的那張表??

正在回答

2 回答

<?php

namespace app\controllers;

use yii\web\Controller;

use app\models\Users;

class IndexController extends Controller{

public function actionIndex(){

//查詢數據

$sql = 'select * from users where id=1'; ? ? ? ? ? ? ? ? ?//一會兒將改這里

$results=Users::findBySql($sql)->all();

print_r($results);

}

}

查詢一次數據庫中users表后,刪掉users表,新建一個users1表,將上述代碼改為

<?php


namespace app\controllers;

use yii\web\Controller;

use app\models\Users;


class IndexController extends Controller{

public function actionIndex(){

//查詢數據

$sql = 'select * from users1 where id=1'; ? ? ? ? ? ? ? ? ?//這里做了改動


$results=Users::findBySql($sql)->all();

print_r($results);

}

}


刷新頁面為什么提示

Invalid Configuration – yii\base\InvalidConfigException

The table does not exist: {{%users}}

我明明要查詢users1了呀,為什么還查詢之前的users?


0 回復 有任何疑惑可以回復我~

貼出你寫的代碼

0 回復 有任何疑惑可以回復我~
#1

琴代語兮 提問者

這里字數不能超過300,我寫在下面了,請幫我看看~
2015-09-23 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
Yii框架不得不說的故事—基礎篇(1)
  • 參與學習       42658    人
  • 解答問題       253    個

通過本視頻教程,為學習YII的快速、安全、專業的特性打下基礎

進入課程

使用php yii 框架,第一次用php代碼查詢Mysql中的表后,修改php代碼,想要查詢另一張表,可為什么每次都查詢剛才查詢過的那張表??

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號