如何输出显示“插入表格的值”的消息?

时间:2011-01-02 10:35:23

标签: php mysql

  

可能重复:
  How would I add a message that says “$user_id Deleted” or “$user_id not found?”

<?php
  error_reporting(0);
  $con=mysql_connect("localhost","root","");

  if (!$con) {
    die('could not connect:'.mysql_error());
  }

  mysql_select_db("final?orgdocs",$con);

  $org_name = $_POST["org_name"];
  $org_type = $_POST["org_type"];
  $org_code = $_POST["org_code"];
  $description = $_POST["description"];

  $stmt = "INSERT INTO organization
           VALUES('".$org_name."','".$org_type."','".$org_code."','".$description."')";
  $result = mysql_query("SELECT * FROM organization WHERE org_name = '$org_name' ");

  echo '<TABLE BORDER = "1">';
  $result1 = $result;

  while ($row = mysql_fetch_array($result1)){
    echo '<TR>'.'<TD>'.'Organization Name'.'</TD>'.'<TD>'.'Organization Type'.'</TD>'.'<TD>'.'Organization Code'.'</TD>'.'<TD>'.'Description'.'</TD>'.'<TD>'.'Constitution'.'</TD>';
    echo '</TR>';
    echo '<TR>'.'<TD>'.$row['org_name'].'</TD>'.'<TD>'.$row['org_type'].'</TD>';
    echo '<TD>'.$row['org_code'].'</TD>'.'<TD>'.$row['description'].'</TD>'.'<TD>';
    echo '</TR>';
  }    
  echo '</TABLE>';
?>

2 个答案:

答案 0 :(得分:0)

    $count = mysql_affected_rows();
    echo "$count values inserted to table”;

答案 1 :(得分:0)

Shortest answerecho 'values inserted to table';