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

  • SEARCH
  • Home
  • 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 640973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:00:44+00:00 2026-05-13T21:00:44+00:00

im trying to insert this query with mysql_query INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,1,1)

  • 0

im trying to insert this query with mysql_query

INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,1,1) ; 
INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,2,1) ; 
INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,3,1) ; 
INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,4,1) ;

and it returns:
1064 – 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 ‘; INSERT INTO um_group_rights (um_group_id,cms_usecase_id,um_right_id) V’ at line 1

it obviously has a problem with the semicolon but i dont understand why. it works without a problem in phpmyadmin.
php version is 5.2.6

  • 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-13T21:00:45+00:00Added an answer on May 13, 2026 at 9:00 pm

    Just to be sure : when you are trying to execute these 4 queries from PHP, you’re calling mysql_query four times ?

    For instance :

    mysql_query("INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,1,1)");
    mysql_query("INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,2,1)");
    mysql_query("INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,3,1)");
    mysql_query("INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,4,1)");
    

    What I mean is : you cannot send several distinct queries at once, with only one call to mysql_query (quoting, emphasis mine) :

    mysql_query() sends a unique query
    (multiple queries are not supported) to the currently active
    database on the server that’s
    associated with the specified
    link_identifier .

    You have to “separate” your queries — which is probably something phpMyAdmin does without telling you.

    And, as @Alexandre pointed out in the comments :

    The query string should not end with a
    semicolon.

    If you are using the mysqli_* functions (and not mysql_*) to access your database, you could try using mysqli_multi_query.

    Unfortunately, there is such function for mysql_*.

    (BTW : the mysql_* API is the old one — it would be better, especially for a new project, to use mysqli_*)


    Edit after the comment :

    If it’s about performances, yes, doing a single call to the database, instead of four successive PHP <-> MySQL calls, could be better.

    In this case, you could try using the insert syntax that allows to insert several lines at once ; see 12.2.5. INSERT Syntax in MySQL’s manual (quoting) :

    INSERT statements that use VALUES
    syntax can insert multiple rows.

    To do this, include multiple lists
    of column values, each enclosed within
    parentheses and separated by commas.

    Example:

    INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
    

    The values list for each row must be
    enclosed within parentheses.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm breaking my head over this. I'm trying to insert embeddable video code, such
i have been stressing for an hour at this stupid script i am trying
I'm trying to execute I have an html form in a page of this
Whatever im trying to do. If i insert into with öäå or making a
So I setup a table using mysql query browser, and now i'm trying to
I am trying to get a guest book to work using PHP. I have
I'm trying to create a simple login system that will have the forms and
Hi everyone im stuck with this code im practically new to php... what im
i'm quite new with php. i think this is quite straight forward but i'm
I have an image upload script, originally I kept it in a file called

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.