0
我有一个SQL查询,如下所示:编写SQL查询在PHP
select * from some_table where some_name_id =
(select some_name_id from some_names where some_name = 'FALL'
and some_other_id = 1)
and year(some_start_date) = 2012 and some_other_id = 1;
注意,'FALL'
和开始日期和some_other_id
将要在动态地从我从读文件送入。我需要的只是在php中写出这个查询的帮助。当谈到那些东西时,我有些不知所措。仍然让我的脚湿与PHP。我忘了提及我不得不使用Doctrine模型。不知道这是否有所作为。
检查[本教程](http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers)。基本上,您完全按照通常的方式编写查询,将占位符放在需要动态输入的地方,绑定输入的实际值,执行。 – DCoder