Why my datatable error when my database table dont have value? heres my code

Why my datatable error when my database table dont have value? heres my code

tetsuphyxiatetsuphyxia Posts: 21Questions: 4Answers: 0


Answers

  • kthorngrenkthorngren Posts: 20,142Questions: 26Answers: 4,736

    What error do you get?

    What is the JSON response when there is no data?

    Kevin

  • tetsuphyxiatetsuphyxia Posts: 21Questions: 4Answers: 0

    Undefined variable sales.
    my variable sale on my foreach for the datables data

  • kthorngrenkthorngren Posts: 20,142Questions: 26Answers: 4,736

    Maybe I'm missing it but I don't see a foreach loop. The error is not a Datatables issue. Sounds like you need to add a check for an empty data set and handle it appropriately.

    Kevin

  • tetsuphyxiatetsuphyxia Posts: 21Questions: 4Answers: 0

    i did not include the foreach loop on the screenshot here is my foreach

  • tetsuphyxiatetsuphyxia Posts: 21Questions: 4Answers: 0

    is my url on ajax is correct? url with parameter? or there are other ways to put a parameter there

  • tetsuphyxiatetsuphyxia Posts: 21Questions: 4Answers: 0

    Coz im getting this error if the datatable is empty

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • tetsuphyxiatetsuphyxia Posts: 21Questions: 4Answers: 0

    its okay now guys thank you, i just change the $sale->client_id to $client->id

This discussion has been closed.