'; foreach($row as $k=>$v){ $str .= ""; } $str .= ""; } $str .= ""; foreach($row as $k=>$v){ $str .= ""; } $str .= ""; } @mysql_free_result($result); echo "
本文介绍下,php实现的一个简单的mysql工具,可能执行多条sql语句,有需要的朋友参考下。

代码如下:



";

//解决不输入无分号找不到sql的问题
for($i=0;$i';
  
  $result = mysql_query(stripslashes($sql));
 
  if (!$result) {
   echo "Could not successfully run query ($sql) from DB: " . mysql_error()."";   
   continue;
  }
 
  if (mysql_num_rows($result) == 0) {
   echo "No rows found, nothing to print so am exiting";
   continue;
  }
 
  // While a row of data exists, put that row in $row as an associative array
  // Note: If you're expecting just one row, no need to use a loop
  // Note: If you put extract($row); inside the following loop, you'll
  //       then create $userid, $fullname, and $userstatus
  $str = "";
  while ($row = mysql_fetch_assoc($result)) {
   if($str == ""){
    $str = '
".$k."
".$v."
"; echo $str; echo "
"; } } ?>
登录后复制


09-11 06:33