insert data into MYSQL using PHP array

前端 未结 3 1175
遇见更好的自我
遇见更好的自我 2021-01-26 08:07

hi im trying to insert data in mysql using array, can someone please look at my code, i cant seem to make it work.

this is my post.php

/* POST.PHP */
$p         


        
3条回答
  •  耶瑟儿~
    2021-01-26 08:47

    The thing is:

    • Maybe your code has some weird indent, but the first definition insertToDB neither appears to be properly closed (maybe it is, at the end of the code section you provide) nor have a return. If it is properly closed, it still lacks a return (it may help you diagnose what is going on have conditional return for success and error cases.
    • You define $query but do not use it later. Unless you append to that string the result of converting your array into another string (a thing that I dont see either), I dont think you are going to INSERT anything to your database.
    • You need to loop through $valuesArr and build a string from your array.

    Maybe I'm missing something...

提交回复
热议问题