在插入或更新mysql之前检查我的代码不起作用我不知道为什么
$sql = "SELECT * FROM downloads WHERE name = '" . $details['name']."' " ;
$result = mysql_query($sql);
if( mysql_num_rows($result) === 0) {
$sql = "INSERT INTO downloads (name, idu) VALUES ('".$details['name']."', '".$details['idu']."')";
$result = mysql_query($sql);
}
else{
$sql2 = "UPDATE downloads SET idu='".$details['idu']."' WHERE name='". $details['name'] ."'";
$result = mysql_query($sql2);
}