Zend Framework convert NULL string to actual NULL value for MySql -


While importing data using a multi-row insert with any (execution) function, many Rows were added for some columns with string faucet. How can I convert those null string to MySQL null values ​​so that I can check the empty values ​​by using is_null () in php when displaying data.

How can I avoid this problem? I was using the quote () function for each piece of data; Was this problem using bidding on empty areas? I was importing a CSV file

Thanks

To insert an SQL NULL or any other expression, you You can use a Zend_Db_Expr object even if you use the quote () , then the ZF passes these objects through unquoted < / P> $ null = New Zend_Db_Expr ("NULL"); $ Table = New MyTable (); $ Table- & gt; Insert (123, "abc", $ null);

Note that except for both the quote and parameter of Zend_Db_Expr , you are responsible for protecting against SQL injection.


This is tangent to your question, but keep in mind that whether you are bulking a CSV file. This can be 20x more than using multi-line INSERT .


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -