Insert data to MySql DB and display if insertion is success or failure

前端 未结 5 1888
执念已碎
执念已碎 2020-12-10 05:09

I am inserting data to a MySQL DB, In case if the insertion fails i need to give an appropriate error message indicating so. According to my code below i will be Echo-

5条回答
  •  情深已故
    2020-12-10 05:57

    $result = mysql_query("INSERT INTO PEOPLE (NAME ) VALUES ('COLE')"));
    if($result)
    {
    echo "Success";
    
    }
    else
    {
    echo "Error";
    
    }
    

提交回复
热议问题