Home  >  Q&A  >  body text

How to read data from two tables in one php


<?phpheader("Content-Type: text/html;charset=utf-8");$servername = "localhost";$username = "root";$password = "168168";$dbname = "mypet";   //数据库名
// 创建连接$conn = new mysqli($servername, $username, $password, $dbname);$conn->query('set names utf8');// Check connectionif ($conn->connect_error) {    die("连接失败: " . $conn->connect_error);}  $sql = "SELECT * FROM `user`";// $sql = "SELECT * FROM `mypet`";// $sql = "SELECT * FROM `ggbond`%

phantomphantom1819 days ago1061

reply all(1)I'll reply

  • 卢小强

    卢小强2019-11-20 09:10:34

    What's the meaning? Next time I will post the code and screenshots. If you want to join the tables, use join. If there are two unrelated tables, just check twice. https://www.runoob.com/mysql/mysql-join.html This is a tutorial on joint table query

    reply
    0
  • Cancelreply