function show_tab_info($tab_name) { $sql = "select * from " . $tab_name; $dbTool = new dbTool(); $result = $dbTool->execute_dql($sql); //显示字段名 echo "<table><tr>"; for ($i = 0; $i < 4; $i++) { echo "<th>"; $fName = mysql_field_name($result, $i); echo $fName; echo "</th>"; } echo "</tr>"; //显示信息 while ($res = mysql_fetch_row($result)) { echo "<tr>"; for ($i = 0; $i < 4; $i++) { echo "<td>" . $res[$i] . "</td>"; } echo "</tr>"; } echo "<table>"; }
<?php require_once "dbTool_class.php"; $dbTool = new dbTool(); $sql2 = "update PartTwo510181199611266719 set answer='无' where formid=2 and questionid=26;"; /*$sql="select * from users1"; $result=$dbTool->execute_dql($sql); while($r=mysql_fetch_assoc($result)){ foreach($r as $key=>$val){ echo $key.'='.$val.'<br/>'; } }*/ /*for(int i=1;i<=26;i++){ if((i=='2')||(i=='8')){ $sql="update Basic142622199005074282 set answer='25' where formid=1 and questionid="i";"; $result=$dbTool->execute_dml($sql); } }*/ //$result1=$dbTool->execute_dml($sql1); $result2 = $dbTool->execute_dml($sql2);
<?php require_once "dbTool_class.php"; $dbTool = new dbTool(); /*$sql="select * from users1"; $result=$dbTool->execute_dql($sql); while($r=mysql_fetch_assoc($result)){ foreach($r as $key=>$val){ echo $key.'='.$val.'<br/>'; } }*/ $sql = "insert PartTwo41152819941207341x(formid,questionid,answer) value(11,2,C);"; $result = $dbTool->execute_dml($sql); //$result1=$dbTool->execute_dml($sql1); //$result2=$dbTool->execute_dml($sql2);