weina67
(Weinanas)
January 31, 2012, 9:14pm
1
I want to do multi queries like
$sql = 'InsERT INTO table (…);
INSERT INTO table (…);
INSERT INTO table (…);’;
Yii::app()->db->createCommand($sql)->execute();
but what Yii function can I use to escape the user input going into the mysql queries?
what Yii function can I use for multiple queries at once?
rookie84
(Lifeline Is)
February 1, 2012, 4:47am
2
Yii::app()->db->quoteValue()
This should do it.
weina67
(Weinanas)
February 4, 2012, 10:23pm
3
When I use that, it puts unnecessary quotation marks around the input… LIke Jane because ‘Jane’ and when I save again it becomes ‘‘Jane’’
hung5s
(Hung5s)
February 5, 2012, 4:22am
4
As I know, you cannot do that with Yii becuase Yii use PDO which does not let you to perform multi-queries in one command. You may have to get the connectionString and other connection info from Yii::app()->db to create a pure PHP-MySQl connection and run mysql_query().
anmishael
(Anmishael)
April 18, 2014, 10:27am
5
mysql_query cannot execute multiple records,- it’ll give you an error. Use mysqli.multi-query instead.