All pastes #510331 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-05-25 21:10 UTC
rendered paste body
if ($_POST) {
	$_POST	= array_map('mysql_real_escape_string', $_POST);
	$error	= array();
	$query = mysql_fetch_array(mysql_query("SELECT * FROM `books` WHERE `title`='".$_POST['title']."' AND `author`='".$_POST['author']."'"));
  if ($query == 1) $error[]="book exists";

	if (size($error)==0) {
		echo "successful";
		mysql insert book
	}
	else {
		foreach ($error as $x) {
			echo $x."<br />";
		}
	}
}