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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:22:42+00:00 2026-06-10T04:22:42+00:00

I have been trying to get this to work for some time. I’m just

  • 0

I have been trying to get this to work for some time. I’m just stumped. Here is the original MYSQL and then the PHP Ive been working on.

MYSQL:

SET @COD_PAIS = 3;
SET @F_HASTACORTE = '2012-03-31 01:00:00';

SELECT mcarteras.DES_CARTERA_CC                 AS 'Short Name of Fund'
     , mcarterasflias.DES_CARTERAFLIA           AS 'I/C'
     , msociedades.DES_SOCIEDAD_CORTO           AS 'Fund Manager Company'
     , mcarteras_clases.DES_CARTERACLASE        AS 'Class'
     , mcarteras_clasesesp.DES_CARTERACLASE_ESP AS 'Special Class'
     , dr_rentmovil_carteras.POR_RENTCARTERA    AS 'TTR year-to-date %'
     , dficha_mes.POR_REMUNERA_COBRADA          AS 'Mgmt Fee Effectively Charged'
     , dficha_mes.POR_GASTOS_TOTALESC           AS 'Total Expenses %'
     , dficha_mes.VR_CARTERA_FCORTE             AS 'Fund Size'
     , dr_rentmovil_carteras.F_HASTACORTE             AS 'Date'
  FROM mcarteras
INNER
  JOIN mcarterasflias
    ON mcarterasflias.ID_CARTERAFLIA           = mcarteras.ID_CARTERAFLIA
INNER
  JOIN msociedades
    ON msociedades.ID_SOCIEDAD                 = mcarteras.ID_SOCIEDADADM
INNER
  JOIN mcarteras_clases
    ON mcarteras_clases.ID_CARTERACLASE        = mcarteras.ID_CARTERACLASE
INNER
  JOIN mcarteras_clasesesp
    ON mcarteras_clasesesp.ID_CARTERACLASE_ESP = mcarteras.ID_CARTERACLASE_ESP  
INNER
  JOIN dr_rentmovil_carteras
    ON dr_rentmovil_carteras.ID_CARTERA        = mcarteras.ID_CARTERA   
   AND dr_rentmovil_carteras.COD_PAIS                                       = @COD_PAIS
   AND dr_rentmovil_carteras.F_HASTACORTE                                =@F_HASTACORTE
   AND dr_rentmovil_carteras.ID_FORMATO = 1
   AND dr_rentmovil_carteras. ID_COLUMNA = 5
INNER
  JOIN dficha_mes
    ON dficha_mes.ID_CARTERA                   = mcarteras.ID_CARTERA   
   AND dficha_mes.COD_PAIS                                                  = @COD_PAIS
   AND dficha_mes.F_CORTE                                              = @F_HASTACORTE 

 WHERE mcarteras.COD_PAIS                                                   = @COD_PAIS
   AND mcarteras.ID_CARTERATIPO = 4
   AND mcarteras.ID_CARTERAFLIA IN ( 3,4 )
   AND mcarteras.IND_PUBLICACION = 1
   AND mcarteras.COD_ESTADO= 1

PHP:
<?php
$con = mysql_connect("localhost","root","");
 if (!$con)
   {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("bdcarterascv2", $con);
$COD_PAIS = '3';
$F_HASTACORTE = '2012-03-31 01:00:00';

$result = mysql_query("SELECT DES_CARTERA_CC               AS 'Short Name of Fund' 
     , mcarterasflias.DES_CARTERAFLIA           AS 'I/C'
     , msociedades.DES_SOCIEDAD_CORTO           AS 'Fund Manager Company'
     , mcarteras_clases.DES_CARTERACLASE        AS 'Class'
     , mcarteras_clasesesp.DES_CARTERACLASE_ESP AS 'Special Class'
     , dr_rentmovil_carteras.POR_RENTCARTERA    AS 'TTR year-to-date %'
     , dficha_mes.POR_REMUNERA_COBRADA          AS 'Mgmt Fee Effectively Charged'
     , dficha_mes.POR_GASTOS_TOTALESC           AS 'Total Expenses %'
     , dficha_mes.VR_CARTERA_FCORTE             AS 'Fund Size'
     ,dr_rentmovil_carteras.F_HASTACORTE        AS'Date'
  FROM mcarteras 
INNER
  JOIN mcarterasflias
    ON mcarterasflias.ID_CARTERAFLIA           = mcarteras.ID_CARTERAFLIA
INNER
  JOIN msociedades
    ON msociedades.ID_SOCIEDAD                 = mcarteras.ID_SOCIEDADADM
INNER
  JOIN mcarteras_clases
    ON mcarteras_clases.ID_CARTERACLASE        = mcarteras.ID_CARTERACLASE
INNER
  JOIN mcarteras_clasesesp
    ON mcarteras_clasesesp.ID_CARTERACLASE_ESP = mcarteras.ID_CARTERACLASE_ESP  
INNER
  JOIN dr_rentmovil_carteras
    ON dr_rentmovil_carteras.ID_CARTERA        = mcarteras.ID_CARTERA   
  AND dr_rentmovil_carteras.COD_PAIS                                       =  $COD_PAIS
   AND dr_rentmovil_carteras.F_HASTACORTE                          =      $F_HASTACORTE
   AND dr_rentmovil_carteras.ID_FORMATO = 1
   AND dr_rentmovil_carteras. ID_COLUMNA = 5
INNER
  JOIN dficha_mes
    ON dficha_mes.ID_CARTERA                   = mcarteras.ID_CARTERA   
   AND dficha_mes.COD_PAIS                                            =      $COD_PAIS
   AND dficha_mes.F_CORTE                                             =  $F_HASTACORTE 

 WHERE mcarteras.COD_PAIS                                                =  $COD_PAIS
   AND mcarteras.ID_CARTERATIPO = 4
   AND mcarteras.ID_CARTERAFLIA IN ( 3,4 )
   AND mcarteras.IND_PUBLICACION = 1
   AND mcarteras.COD_ESTADO= 1
")
or die(mysql_error());

// HTML ... Aliases from Mysql
echo "<table border='1'>
<tr>
<th>Short Name of Fund</th>
<th>I/C</th>
<th>Fund Manager Company</th>
<th>Class</th>
<th>Special Class</th>
<th>TTR year-to-date %</th>
<th>Mgmt Fee Effectively Charged</th>
<th>Total Expenses %</th>
<th>Fund Size</th>
<th>Date</th>
</tr>";

//<tr> specifies table row. for each <td> (table data) will specify a new column.  The     $row specifies the mysql column name (in this case using an alias)
while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['Short Name of Fund'] . "</td>";
 echo "<td>" . $row['I/C'] . "</td>";
  echo "<td>" . $row['Fund Manager Company'] . "</td>";
  echo "<td>" . $row['Class'] . "</td>";
  echo "<td>" . $row['Special Class'] . "</td>";
  echo "<td>" . $row['TTR year-to-date %'] . "</td>";
  echo "<td>" . $row['Mgmt Fee Effectively Charged'] . "</td>";
  echo "<td>" . $row['Total Expenses %'] . "</td>";
  echo "<td>" . $row['Fund Size'] . "</td>";
   echo "<td>" . $row['Date'] . "</td>";
  echo "</tr>";
  }
echo "</table>";

mysql_close($con);
?>

Here is the current 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 ’01:00:00 AND dr_rentmovil_carteras.ID_FORMATO = 1 AND dr_rentmovil_carte’ at line 28

Any help would be greatly appreciated.

  • 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-10T04:22:44+00:00Added an answer on June 10, 2026 at 4:22 am

    You need to wrap the datetime string in quotes:

    ='$F_HASTACORTE'
    

    Otherwise it is evaluating 2012-03-31 01:00:00 as a number, not a datetime.

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

Sidebar

Related Questions

Okay I have been trying to get this to work for some time now.
Hey I have been trying to work on this for some time but I
I have been trying to get this to work correctly and I think I
I have been trying to get this jsfiddle to work. So far without luck.
This is crazy, I have been trying for hours to get this to work.
I have been trying to work with NIO SocketChannels for some time now, and
I have been trying to get this one section of my UI to immediatly
I have been trying to days now to get this website completed ... however,
I have been trying to get my Arduino/Eclipse environment setup. For some reason I
I have been trying to get Twitter Bootstrap btn-group with dropdown to work for

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.