Bind the column to the dispute account of the column King. Bind the column to the dispute account of the column King? Phptry {$ dbhnewPDO (mysql: dbnametestdb; hostlocalhost, mysql_user, mysql_pwd); $ dbh-setAttribute (PDO: ATTR_ERRMODE, PDO: ER binding column, dispute account binding of column King
SetAttribute (PDO: ATTR_ERRMODE, PDO: ERRMODE_EXCEPTION);} catch (PDOException $ e) {echo 'database connection failed :'. $ e-> getMessage (); exit;} // declare a SELECT query. obtain the information of the four fields of D01 from the contactInfo table. $ query = "SELECT uid, name, phone, email FROM contactInfo WHERE initialize mentid = 'd01' "; try {$ stmt = $ dbh-> prepare ($ query ); // prepare a declared query $ stmt-> execute (); // execute the prepared query $ stmt-> bindColumn (1, $ uid ); // bind the variable $ uid $ stmt-> bindColumn (2, $ name) through the column position offset ); // bind the variable $ name $ stmt-> bindColumn ('phone', $ phone) through the column position offset ); // bind the column name to the variable $ phone $ stmt-> bindColumn ('email ', $ email ); // bind the column name to the variable $ email while ($ stmt-> fetch (PDO: FETCH_BOUND) {// The fetch () method transmits a specific parameter to traverse echo $ uid. "\ t ". $ name. "\ t ". $ phone. "\ t ". $ email. "\ n"; // The output automatically assigns the column value to the value of the corresponding variable} catch (PDOException $ e) {echo $ e-> getMessage ();}
Why? Php try {$ dbh = new PDO ('MySQL: dbname = testdb; host = localhost', 'MySQL _ user', 'MySQL _ pwd '); $ dbh-setAttribute (PDO: ATTR_ERRMODE, PDO: ER...