Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Cdbcommand Failed To Execute The Sql Statement: Sqlstate[42000]: Syntax Error Or Access Violation:

$
0
0
Everything works fine on localhost but after i have uploaded to host i get the following error
CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3. The SQL statement executed was: SELECT *
FROM `Image`
WHERE

It looks like its not recognizing the where parameters, but why it does locally but not once I have uploaded to a host
Here is the code that i have in my view that is generating the error
<?php
 $rows = Yii::app()->db->createCommand()
    ->from("Image")
    ->where(array("types = admin"))
    ->queryAll();
foreach($rows as $row)
{

    $imghtml=CHtml::image(Yii::app()->request->baseUrl.'/images/thumb/'.$row['image']);
    echo '<a class = "image" href="'.Yii::app()->request->baseUrl.'/generator/create?image='.$row['image'].'">'.$imghtml.'</a>   ';

}

?>

Viewing all articles
Browse latest Browse all 18717

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>