(1)code <body bgcolor=green> <?php function exeSQL($con,$sql){ if( $query= mysqli_query($con, $sql) ) {echo " $sql 成功!<br> "; } else { echo " $sql Failure!<br> "; } return $query; }
$sql= "select * from $table"; $query=exeSQL($con,$sql); echo "<tr bgcolor=cyan>"; $fc= mysqli_num_fields($query) ; while ($field = mysqli_fetch_field($query)){ printf("<td bgcolor=pink>%s", $field->name); } echo "<td>DEL"; $rowc=0; while ($row = mysqli_fetch_array($query)){ echo "<tr bgcolor=purple>"; for ($i=0;$i<$fc;$i++){ echo "<td bgcolor=gray>" . $row[$i]; } echo "<td><a href=a4.php?id=" . $row[0] .">DEL</a>"; $rowc++; } echo "</table>"; echo "資料表 $table 共計有 $rowc 筆資料。<br><br>"; } if (!$con) { echo "Error"; exit(); } dumpTableForDel("custs",$con,"yellow"); ?> </body> (2)mid result(http://localhost/a4.php) select * from custs 成功!
資料表 custs 共計有 4 筆資料。 (3)final result(http://localhost/a4.php?id=10001) select * from custs 成功!
資料表 custs 共計有 4 筆資料。
資料表 custs 共計有 3 筆資料。
|