时间:2021-07-01 10:21:17 帮助过:43人阅读
".mysql_error()."
"; } if(isset($_post['author']) && isset($_post['title']) && isset($_post['category']) && isset($_post['year']) && isset($_post['isbn'])) { $author = get_post('author'); $title = get_post('title'); $category = get_post('category'); $year = get_post('year'); $isbn = get_post('isbn'); $query = "INSERT INTO classics VALUES". "('$author','$title','$category','$year','$isbn')"; if(!mysql_query($query, $db_server)) { echo "INSERT failed: $query
".mysql_error()."
"; } } echo <<<_END _END; $query = "SELECT * FROM classics"; $result = mysql_query($query); if(!$result) die("Datebase access failed: ".mysql_error); $rows = mysql_num_rows($result); for($j = 0; $j<$rows; ++$j) { $row = mysql_fetch_row($result); echo <<<_ENDAuthor $row[0] Title $row[1] category $row[2] year $row[3] ISBN $row[4]_END; } mysql_close($db_server); function get_post($var) { return mysql_real_escape_string($_POST[$var]); }?>
加断点一步一步调试。