Skip to content
Advertisement

Adding multiple entries to a table

I am trying to register customers for a continuing education web site I am creating and need to add multiple entries to the phpMyAdmin table “users” for registration purposes. I am trying to add multiple entries, 25 total.

As you will see, I have tried the mysqli_multi_query() function to add them all but I cannot create a new record of those entries.

It shows that I am connected to the database and I have checked all values in the code with those in the table and they are ordered. So my questions are:

  • Is there a limit of entries per table?
  • Is it best to add few entries at a time than a sign-in page with multiple lines?
  • Am I trying to do too much in one file and need to split my job?

Error I am getting:

JavaScript

The code so far validates all entries, checks if there are blank entries, and uses the function test-input. Any help is appreciated, including sources from where to learn PHP that worked better for your education. Thanks in advance and thank you for listening.

JavaScript

Advertisement

Answer

You need to prepare your sql, bind the params and then execute. Forget the mysqli functions.

JavaScript

You’re getting that error because mysql doesn’t know what ? is. You are litterally try to execute INSERT INTO users (city, ste, zip) VALUES (?, ?, ?); which is not valid sql. The variables have to be converted first.

Also, this might be a little advanced for you but you can definitely refactor a lot of redundant code out of this… Just practice and you’ll get it!

Here’s a rough in of what I’m talking about

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement