I am learning to program in PHP but when I insert the data with the post method it marks the error "Call to a member function query () on null".
$ key = $ _POST ['key']; $ Description = $ _POST ['des']; $ code = $ _POST ['cb']; $ pc = $ _POST ['pc']; $ Wholesale = $ _POST ['pma']; $ Retail = $ _POST ['pmu']; $ suggested = $ _POST ['suggested'];
$ insert="INSERT INTO product (key, description, code, pc, wholesale, retail, suggested) values ('$ password', '$ description', '$ code', '$ pc', '$ wholesale ',' $ Retail ',' $ suggested ') ";
$ execute = $ link-> query ($ insert); if (! execute) { printf ("Error", $ link -> error); } else { echo "added correct"; }
mysqli_close ($ link); echo "Correct data";
Someone to help me since I can not find an error in my code?