php - mysql query yii not getting value -
php - mysql query yii not getting value -
i have issue gettin' value query:
public static function sa() { $resul = yii::app()->db->createcommand()->select('max(id)')->from('yii_availability')->execute(); $got = mysql_query($result); $res = $got['max(id)'] + 1; $rs='sa'.$res; homecoming "{$rs}"; }
it homecoming sa1, want lastly id , after plus 1 in case have next autoincremental id id column.
for example: creating new registry field sa0000005. number calculated getting lastly autoincremental value plus 1.
thanks valuable help
$resul = yii::app()->db->createcommand()->select('max(id)')->from('yii_availability')->execute(); $got = mysql_query($result); // doing here
apart typos, that's not how supposed utilize query builder. have read the documentation on query builder?
the probable reason why sa1, because $got['max(id)']
look null. add together 1 that. want like this.
// returns false on no-result, max('id') otherwise yii::app()->db->createcommand()->select('max(id)')->from('yii_availability')->queryscalar();
php mysql yii
Comments
Post a Comment