function addhash($hash,$crypto){
$con = mysql_connect("localhost","root","pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("crypto", $con);
$sql1 = "SELECT * FROM hash";
if(mysql_query($sql1,$con) == "NULL"){
$sql="INSERT INTO hash (hash, string, hashtype) VALUES ('$hash','$_POST[str]','$crypto')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Hash added to database";
mysql_close($con);
} else {
echo 'already in database';
}
}
If you know anything about coding you see what I want that to do please help me fix it