1
ramoneariel
problem with $xoopsDB->prefix()
  • 2008/3/27 14:34

  • ramoneariel

  • Just popping in

  • Posts: 6

  • Since: 2005/11/23


I'v problem with $xoopsDB->prefix() in a consult to DB with a subconsult.

Sorry for my english.

This's the sentence

$result = $xoopsDB->queryF("SELECT v_venta_nro FROM ".$xoopsDB->prefix("ventas")." WHERE id = (SELECT MAX(id) FROM ".$xoopsDB->prefix("ventas")." LIMIT 1 )ORDER BY id DESC") ;

$row = mysql_fetch_array($result);

2
nachenko
Re: problem with $xoopsDB->prefix()
  • 2008/3/27 14:52

  • nachenko

  • Quite a regular

  • Posts: 356

  • Since: 2005/1/18


Why don't you put the prefixed table name in a variable instead of executing the prefix method twice?

Like this:

$ventas_table = $xoopsDB->prefix('ventas');

then

$result = $xoopsDB->queryF("SELECT v_venta_nro FROM $ventas_table WHERE id = (SELECT MAX(id) FROM $ventas_table LIMIT 1 )ORDER BY id DESC") ;

3
ramoneariel
Re: problem with $xoopsDB->prefix()
  • 2008/3/27 16:11

  • ramoneariel

  • Just popping in

  • Posts: 6

  • Since: 2005/11/23


Ok, Gracias. De esta manera funciona, pero no deberia tener que hacerlo.

Login

Username:
Password:

Lost Password? Register now!

Who's Online

59 user(s) are online (30 user(s) are browsing Support Forums)


Members: 0


Guests: 59


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits