indexAction.class.php上
public function InsertBulletin()
{
$this->insert("BulletinInfo");
}
public function insert($tableName)
{
$TableName =D("$tableName");
if($TableName->create())
{
if(false!==$TableName->add())
{
$this->success("数据添加成功!");
}
else
{
$this->error("数据写入错误");
}
}
else
{
echo $TableName->getLastSql();
}
dump($TableName);
echo $TableName->getLastSql();
}
BulletinInfoModel.class.php文件上是
<?php
class BulletinInfo extends Model
{
protected $_validate =array(
array('title','require','标题必须!',1),
array('content','require','内容必须'),
array('title','','标题已经存在',0,'unique',self::MODEL_INSERT),
);
protected $_auto=array(
array('userId','1',self::MODEL_INSERT),
array('createTime','time',self::MODEL_INSERT,'funtion'),
);
}
?>
dump($TableName);打印的是
object(Model)[3]
private '_extModel' => null
protected 'db' =>
object(DbMysql)[5]
protected 'dbType' => string 'MYSQL' (length=5)
protected 'autoFree' => boolean false
public 'debug' => boolean false
protected 'pconnect' => boolean false
protected 'queryStr' => string '' (length=0)
protected 'lastInsID' => null
protected 'numRows' => int 0
protected 'numCols' => int 0
protected 'transTimes' => int 0
protected 'error' => string '' (length=0)
protected 'linkID' =>
array
empty
protected '_linkID' => null
protected 'queryID' => null
protected 'connected' => boolean false
protected 'config' =>
array
'dbms' => string 'mysql' (length=5)
'username' => string 'root' (length=4)
'password' => string '123456' (length=6)
'hostname' => string '127.0.0.1' (length=9)
'hostport' => string '3306' (length=4)
'database' => string 'shoppingdb' (length=10)
'dsn' => null
'params' => null
protected 'beginTime' => null
protected 'comparison' =>
array
'eq' => string '=' (length=1)
'neq' => string '!=' (length=2)
'gt' => string '>' (length=1)
'egt' => string '>=' (length=2)
'lt' => string '<' (length=1)
'elt' => string '<=' (length=2)
'notlike' => string 'NOT LIKE' (length=8)
'like' => string 'LIKE' (length=4)
protected 'selectSql' => string 'SELECT%DISTINCT% %FIELDS% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%%ORDER%%LIMIT%' (length=80)
protected 'pk' => string 'id' (length=2)
protected 'tablePrefix' => string 'sp_' (length=3)
protected 'tableSuffix' => string '' (length=0)
protected 'name' => string 'BulletinInfo' (length=12)
protected 'dbName' => string '' (length=0)
protected 'tableName' => string '' (length=0)
protected 'trueTableName' => string '' (length=0)
protected 'error' => string '' (length=0)
protected 'fields' =>
array
'_autoinc' => boolean false
protected 'data' =>
array
empty
protected 'options' =>
array
empty
protected '_validate' =>
array
empty
protected '_auto' =>
array
empty
protected '_map' =>
array
empty
protected 'autoCheckFields' => boolean true
不知道错误在那,看不到那句执行的MYSQL语句,求帮助。。
public function InsertBulletin()
{
$this->insert("BulletinInfo");
}
public function insert($tableName)
{
$TableName =D("$tableName");
if($TableName->create())
{
if(false!==$TableName->add())
{
$this->success("数据添加成功!");
}
else
{
$this->error("数据写入错误");
}
}
else
{
echo $TableName->getLastSql();
}
dump($TableName);
echo $TableName->getLastSql();
}
BulletinInfoModel.class.php文件上是
<?php
class BulletinInfo extends Model
{
protected $_validate =array(
array('title','require','标题必须!',1),
array('content','require','内容必须'),
array('title','','标题已经存在',0,'unique',self::MODEL_INSERT),
);
protected $_auto=array(
array('userId','1',self::MODEL_INSERT),
array('createTime','time',self::MODEL_INSERT,'funtion'),
);
}
?>
dump($TableName);打印的是
object(Model)[3]
private '_extModel' => null
protected 'db' =>
object(DbMysql)[5]
protected 'dbType' => string 'MYSQL' (length=5)
protected 'autoFree' => boolean false
public 'debug' => boolean false
protected 'pconnect' => boolean false
protected 'queryStr' => string '' (length=0)
protected 'lastInsID' => null
protected 'numRows' => int 0
protected 'numCols' => int 0
protected 'transTimes' => int 0
protected 'error' => string '' (length=0)
protected 'linkID' =>
array
empty
protected '_linkID' => null
protected 'queryID' => null
protected 'connected' => boolean false
protected 'config' =>
array
'dbms' => string 'mysql' (length=5)
'username' => string 'root' (length=4)
'password' => string '123456' (length=6)
'hostname' => string '127.0.0.1' (length=9)
'hostport' => string '3306' (length=4)
'database' => string 'shoppingdb' (length=10)
'dsn' => null
'params' => null
protected 'beginTime' => null
protected 'comparison' =>
array
'eq' => string '=' (length=1)
'neq' => string '!=' (length=2)
'gt' => string '>' (length=1)
'egt' => string '>=' (length=2)
'lt' => string '<' (length=1)
'elt' => string '<=' (length=2)
'notlike' => string 'NOT LIKE' (length=8)
'like' => string 'LIKE' (length=4)
protected 'selectSql' => string 'SELECT%DISTINCT% %FIELDS% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%%ORDER%%LIMIT%' (length=80)
protected 'pk' => string 'id' (length=2)
protected 'tablePrefix' => string 'sp_' (length=3)
protected 'tableSuffix' => string '' (length=0)
protected 'name' => string 'BulletinInfo' (length=12)
protected 'dbName' => string '' (length=0)
protected 'tableName' => string '' (length=0)
protected 'trueTableName' => string '' (length=0)
protected 'error' => string '' (length=0)
protected 'fields' =>
array
'_autoinc' => boolean false
protected 'data' =>
array
empty
protected 'options' =>
array
empty
protected '_validate' =>
array
empty
protected '_auto' =>
array
empty
protected '_map' =>
array
empty
protected 'autoCheckFields' => boolean true
不知道错误在那,看不到那句执行的MYSQL语句,求帮助。。
$TableName =D($tableName);
if($TableName->create())
{
//在这里就进不了
if(false!==$TableName->add())
{