PHP SQL Query inside another Query's fetch() statement

爷,独闯天下 提交于 2019-12-08 11:00:20

问题


This didn't return any helpful google results, so I'll just ask it here:

Is it possible in PHP to start another query inside another query's fetch statement after executing() the first query?

e.g.

if ($stmt=mysqli->prepare(query)) {
    $stmt->bind_param('s', $variable);
    $stmt->execute();
    $stmt->store_result();
    while ($stmt->fetch()) {
         if ($stmt2=mysqli->prepare(query2)) {
              $stmt2->bind_param('s', $othervariable);
              $stmt2->execute();
              $stmt2->store_result();
              while ($stmt2->fetch()) {
                  store result or something
              }
         }
    }
}

来源:https://stackoverflow.com/questions/18136762/php-sql-query-inside-another-querys-fetch-statement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!