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 8829659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:53:07+00:00 2026-06-14T07:53:07+00:00

I was given a MySQL query: SET @COD_PAIS = 3, @ID_CARTERA = 8; SELECT

  • 0

I was given a MySQL query:

SET @COD_PAIS = 3, @ID_CARTERA = 8; 
SELECT 
    C.DES_PERMADURACION AS Item
    , B.POR_MADURACION AS Percentage_Distribution 
FROM dficha_mes A 
JOIN det_maduraciones B 
    ON ( A.ID_FICHA_MES = B.ID_FICHA_MES ) 
JOIN mpermaduraciones C 
    ON ( B.ID_PERMADURACION = C.ID_PERMADURACION ) 
WHERE A.ID_CARTERA = @ID_CARTERA 
AND A.COD_PAIS = @COD_PAIS 
AND B.F_CORTE = ( 
                    SELECT 
                        F_ULT_CIERRE_MENSUAL 
                    FROM mpaises 
                    WHERE COD_PAIS = @COD_PAIS );

The table has rows and columns in Spanish.

When I run this query using PHP’s mysql_query(), I get the following error:

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 'SELECT 
        C.DES_PERMADURACION AS Item
        , B.POR_MADURACION AS Percentage_Distrib' at line 2

However this query runs perfectly from MySQL Workbench or even SQLYog.

Any pointers here?

  • 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-06-14T07:53:08+00:00Added an answer on June 14, 2026 at 7:53 am

    You can’t submit multiple queries in a single string in PHP. You’ll need to do them as separate calls to mysql_query(), or use the mysqli interface instead (which is what you should be doing anyway).

    http://php.net/manual/en/book.mysqli.php

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

Sidebar

Related Questions

Assume that the following query is issued to a MySQL database: SELECT * FROM
Given a bunch of images .gif which I retrieve from mySQL, I need to
Using PHP, for-each row in a MySQL query's result set, I need to execute
I'm using the following mysql query to return some data from my database. Currently
I'm building a MySQL query to determine how many items from each of several
I currently have a list of things to update in the given mysqli query:
Why does the MySQL query below give error 1066 (Not unique table/alias: 'customer') ?
I am trying to write a MySQL query that gives me results of Organisation
Is there a way to query a MySQL database that gives me all blobs
Given a MySQL table of real estate data, I would like to generate a

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.