function execute_dql($sql) { $res = mysql_query($sql, $this->conn); while ($row = mysql_fecth_row($res)) { foreach ($row as $key => $val) { echo "{$val}"; } } echo "<br/>"; }
<?php header("Content-type:text/xml"); mysql_connect("127.0.0.1", "root", ""); $result = mysql("hr2", "SELECT LastName,FirstName\nFROM Employees ORDER BY LastName,FirstName"); $i = 0; echo '<data_mahasiswa>'; while ($i < mysql_numrows($result)) { $fields = mysql_fecth_row($result); echo "<nama>{$fields['1']} {$field['0']} </nama>\r\n"; $i++; } echo '</data_mahasiswa>'; mysql_close();