Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 958549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:53:09+00:00 2026-05-16T00:53:09+00:00

I was inserting multiple arrays into my database using this code: $queries_cols = array();

  • 0

I was inserting multiple arrays into my database using this code:

$queries_cols = array(); 

for($i=0; $i<count($cols); $i++) 
{ 
    $queries_cols [] = "('".$cols[$i]."','".$int_manha1_1[$i]."','".$int_manha1_2[$i]."','" .$int_tarde2_1[$i]."','".$int_tarde2_2[$i]."','".$h1_1[$i].$h1_2[$i]."','".$h2_1[$i].$h2_2[$i]."')" ; 
}

$query_col = "INSERT into cols_ponto_diaria values '".implode(",", $queries_cols)."'";

$result = mysql_query($query_col) or die("Erro: ".mysql_error());

And when I submit the form it output an error:

Erro: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''('Ricardo','08:30:00','12:15:00','14:45:00','18:00:00','0115','1215')'' at line 1

Can anyone find where is the error? I’ve tried a few solutions but without any success.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T00:53:10+00:00Added an answer on May 16, 2026 at 12:53 am

    You could easily find it by printing $query_col as soon as you have it ready.

    Anyway, the error I believe is in the implode() call. You don’t need the extra quotes.

    So instead of

    $query_col = "INSERT into cols_ponto_diaria values '".implode(",", $queries_cols)."'";
    

    try

    $query_col = "INSERT into cols_ponto_diaria values ".implode(",", $queries_cols);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need some help with inserting multiple rows from different arrays into my database.
i'm having an issue using C# inserting multiple rows into a MySQL database, have
I got an array of 650 rows. Inserting this using PDO takes between 10-15
I'm inserting multiple records to a table using the below query: INSERT INTO Table1(FirstName,
Hi i am having problem inserting data into multiple table from one view. First
I am reading in some raw files and inserting them into a DB. This
I'm inserting multiple rows in a table, and I get this message: MySQL server
I'm using javascript, and I have an array containing multiple values, which may be
I'm inserting multiple rows from one table to another, based on ID. For this
I am dynamically inserting a row into a table with JQuery using clone. $('#Clone').click(function()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.