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

2019-06-14 08:34发布

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
              }
         }
    }
}

0条回答
登录 后发表回答