mysql表中列太多的数据库错误

I am facing an issue with the mysql database. I am doing a project in php. I have around 10 columns in a table is fine with it.

If i am increasing to around 20 columns in a table, it is storing the data into the database and also if i made it to around 30 columns in a row of single table, it is also working on present state.

But once i finished all the database, coding and come back on next day. I am getting an error as

cannot execute the command

Data is not stored in the database.

It makes me really confused as too much of data is stored in columns and i don't know the reason of not executing the code as it works better on yesterday.

And this is the process repeating for a week and i couldn't solve it yet

Here is my sample code

if(isset["$_post('submit)"]){

$sample1 = ($_POST['sample1']);
$sample2 = ($_POST['sample2']);
$sample3 = ($_POST['sample3']);
$sample4 = ($_POST['sample4']);
$'' = ($_POST['']);
$....
$...
$...

$result = $func->execute("INSERT INTO sample(sample1,sample2,sample3,sample4,..,..,..,..,..,..,..) VALUES('$sample1','$sample,'$sample3','$sample4','..','..','..')");
if($result){
echo "Successfully stored ";
} else { echo "Data are not stored";
}

}

The dots are as there are still more data in the code and $func->execute to store the data and it is been already coded.

My query is that, do i separate the code into two or is there a way to store more columns in a single form that is been executed in single page or do i can separate the code into two section with two insert query in different php page that will be stored into the same table of database