Error con propiedades

edited enero 2009 in Dudas/Problemas
<?
class ArticlesController extends ApplicationController {
public $template = "index";
function view($id) { //Tomamos, el ID; Jaja... <!-- s:P --><img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz" /><!-- s:P -->
$this->articulo = new Articulo();
$this->articulo->find("id = $id");
$this->categoria = new Categoria();
echo $this->articulo->categoria;
$this->categoria->find("id = {$this->articulo->categoria_id}");
}
}
Notan algun error?

Kumbia si, jeje... <!-- s:P --><img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz" /><!-- s:P -->

KumbiaException: 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 '' at line 1 al ejecutar "SELECT id,nombre,nombreen,description,descriptionen,menu,photo,invertable FROM categoria WHERE id = " (1064)
En el archivo C:\AppServ\www\WebPortal\library\kumbia\db\adapters\mysql.php en la línea: 182<

Comentarios

  • el error es que al parecer el ID no esta llegando bien, si quieres las prueba haciendo un print_r a esa variable y veras que no tiene nada, puedes tomar ese parámetros que le pasas a la action del controller mediante $this->parameters[0] tiene el mismo efecto
  • edited 6:08
    Aún así no funciona.

    Lo estoy haciendo así:

    <!-- m --><a class="postlink" href="http://localhost/WebPortal/articles/view/28">http://localhost/WebPortal/articles/view/28</a><!-- m -->

    <?
    class ArticlesController extends ApplicationController {
    public $template = "index";
    function view($id) { //Tomamos, el ID; Jaja... <!-- s:P --><img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz" /><!-- s:P -->
    $this->articulo = new Articulo();
    $this->articulo->find("id = {$id}");
    $this->categoria = new Categoria();
    echo $this->articulo->categoria;
    $this->categoria->find("id = {$this->articulo->categoria_id}");
    }
    }
    ?>

    No me debería dar el error con la linea en donde le asigno el ID al Artículo?
  • No me debería dar el error con la linea en donde le asigno el ID al Artículo?
    No necesariamente...

    Como te dije usa el $this->parameters[0]
    $this-&gt;articulo = new Articulo();
    $this-&gt;articulo-&gt;find(&quot;id = {$id}&quot;);
    $this-&gt;categoria = new Categoria();
    echo $this-&gt;articulo-&gt;categoria;
    $this-&gt;categoria-&gt;find(&quot;id = {$this-&gt;articulo-&gt;categoria_id}&quot;);
    

    en cuanto a este código es mas elegante que utilices las relaciones de Kumbia, te ahorran esas lineas...
  • edited 6:08
    Pero de todas formas no funciona.

    Tendrá algo que ver, que tengo la última Versión de Kumbia, pero no he Corregido los Bugs?

    Y si es así, ¿Cómo actualizo sin descargarme 1 a 1 cada archivo?
  • Y si es así, ¿Cómo actualizo sin descargarme 1 a 1 cada archivo?
    Puedes registrarte en el launchpad[1] y bajarte el código directamente de ahí...

    [1]->https://launchpad.net/kumbia
Sign In or Register to comment.