有什么方法可以在一个查询中更新两个表?下面是我的代码示例。如何将这两个更新查询合二为一?先感谢您!
<?php
// DATABASE UPDATE
if (isset($_POST['submit']) or isset($_GET['submit'])){
// 1st QUERY
$db =& JFactory::getDBO();
$query_1 = "UPDATE table_1
SET name = '".$_POST["name"]."',
surename = '".$_POST["surename"]."'
WHERE id=1";
$db->setQuery($query_1);
$db->query();
// 2nd QUERY
$db =& JFactory::getDBO();
$query_2 = "UPDATE table_2
SET team_id = '".$_POST["team_id"]."',
SET team_name = '".$_POST["team_name"]."'
";
$db->setQuery($query_2);
$db->query(); } ?>