How can I loop through all rows of a table? (MySQL)

后端 未结 5 1074
情深已故
情深已故 2020-11-27 10:56

I have a table A and there is one primary key ID.

Now I want to go through all rows in A.

I found something like \'for each record in A\', but this seems to

5条回答
  •  再見小時候
    2020-11-27 11:35

        Use this:
    
        $stmt = $user->runQuery("SELECT * FROM tbl WHERE ID=:id");
        $stmt->bindparam(":id",$id);
        $stmt->execute();
    
            $stmt->bindColumn("a_b",$xx);
            $stmt->bindColumn("c_d",$yy);
    
    
        while($rows = $stmt->fetch(PDO::FETCH_BOUND))
        {
            //---insert into new tble
        }   
    

提交回复
热议问题