2014-10-22 14:55:03 3337次浏览 1条回答 0 悬赏 0 金钱

可以连接mysql 数据库, 但是不能用 find 及 findall 方法。。

直接执行sql 不能用select * , 只能用select 确定的字段名。

求科普。。。。。。

这样可以:

$sql = 'select W_id from Wine';
var_dump(Yii::app()->db->createCommand($sql)->queryAll());

这样不可以

$sql = 'select * from Wine';
var_dump(Yii::app()->db->createCommand($sql)->queryAll());

这样也不可以(Wine 模块没问题)

$wines = Wine::model()->findAll();
var_dump($wines);

错误页面是这样的(不能上传截图 呢)

The connection was reset

The connection to the server was reset while the page was loading.

The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer's network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
您需要登录后才可以回答。登录 | 立即注册
l342515587
实习生

l342515587

注册时间:2014-10-22
最后登录:2014-10-22
在线时长:0小时19分
  • 粉丝0
  • 金钱0
  • 威望0
  • 积分0

热门问题