5

Is there any Online Web Tool that Convert mySQL Query To Zend FrameWork Query. that is i type mySql Query and the Tool Convert it to Zend FrameWork equivalent Query

Edward Maya
  • 429
  • 2
  • 10
  • 25
  • Need a little more information - you can use regular SQL queries with `Zend_Db`, or build the query using `Zend_Db_Select` – Tim Lytle Apr 14 '12 at 23:54
  • 2
    I think your premiss is flawed. Zf generates SQL queries from php code. There is no special `Zend FrameWork equivalent Query`. You actually have multiple options on how you want to build your queries in ZF. If you really want to work in SQL, execute your SQL queries with Zend_Db_Statement and enjoy. – RockyFord Apr 15 '12 at 06:19

1 Answers1

2

You don't need a tool for this. Within Zend Framework's Zend_Db, component, you can do:

$stmt = $db->query($sql);

If $sql is a select, then you can retrieve the data with:

$rows = $stmt->fetchAll();

Alternatively, ZF is just a PHP framework, so there's nothing stopping you continuing to use PDO or mysqli directly.

Rob Allen
  • 12,643
  • 1
  • 40
  • 49
  • i know i can use mysql query,u know the difference b/w syntax of genral mysql query and zf query.zf query syntax is bit difficult so i need to convert mysql query to zf equailent query – Edward Maya Apr 18 '12 at 12:41
  • 3
    The SQL string is identical if you use `$db->query()`. If you want to use the `Zend_Db_Select` object, then that is a different matter and you should post a separate question with an explicit SQL statement that you are trying to convert to `Zend_Db_Select`. – Rob Allen Apr 18 '12 at 12:44