Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Kohana] Zapytanie w ORM.
Pytajka
post
Post #1





Grupa: Zarejestrowani
Postów: 60
Pomógł: 0
Dołączył: 6.09.2011

Ostrzeżenie: (0%)
-----


Witam,

może ktoś mnie uświadczyć jak przerobić to zapytanie -

  1. SELECT * FROM `bricks` INNER JOIN `users` ON `bricks`.author = `users`.id WHERE `bricks`.id = '$id'


na ORM?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 7)
lukasz_os
post
Post #2





Grupa: Zarejestrowani
Postów: 203
Pomógł: 55
Dołączył: 23.11.2008
Skąd: UKF

Ostrzeżenie: (0%)
-----


  1. $entry = ORM::factory('bricks')
  2. ->select('users.*')
  3. ->join('users','inner')
  4. ->on('bricks.author', '=', 'users.id')
  5. ->where('bricks.id', '=', $id)
  6. ->find();


nie testowane gdyż nie mam odpowiednich danych (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
Pytajka
post
Post #3





Grupa: Zarejestrowani
Postów: 60
Pomógł: 0
Dołączył: 6.09.2011

Ostrzeżenie: (0%)
-----


Cytat
Unknown column 'bricks.id' in 'where clause' [ SELECT `brick`.* FROM `bricks` AS `brick` INNER JOIN `users` ON (`bricks`.`author` = `users`.`id`) WHERE `bricks`.`id` = '20' ]
Go to the top of the page
+Quote Post
lukasz_os
post
Post #4





Grupa: Zarejestrowani
Postów: 203
Pomógł: 55
Dołączył: 23.11.2008
Skąd: UKF

Ostrzeżenie: (0%)
-----


  1. $entry = ORM::factory('bricks')
  2. ->select('users.*')
  3. ->join('users','inner')
  4. ->on('brick.author', '=', 'users.id')
  5. ->where('brick.id', '=', $id)
  6. ->find();


Bo ORM zmieniło ci nazwy kolumn z bricks na brick (IMG:style_emoticons/default/smile.gif)

Ten post edytował lukasz_os 25.04.2012, 17:21:18
Go to the top of the page
+Quote Post
pedro84
post
Post #5





Grupa: Nieautoryzowani
Postów: 2 249
Pomógł: 305
Dołączył: 2.10.2006

Ostrzeżenie: (0%)
-----


Nie masz kolumny id w tej tabeli.
Go to the top of the page
+Quote Post
Pytajka
post
Post #6





Grupa: Zarejestrowani
Postów: 60
Pomógł: 0
Dołączył: 6.09.2011

Ostrzeżenie: (0%)
-----


Oczywiście, że mam :- )
Go to the top of the page
+Quote Post
pedro84
post
Post #7





Grupa: Nieautoryzowani
Postów: 2 249
Pomógł: 305
Dołączył: 2.10.2006

Ostrzeżenie: (0%)
-----


Pokaż strukturę tabel.
Go to the top of the page
+Quote Post
Pytajka
post
Post #8





Grupa: Zarejestrowani
Postów: 60
Pomógł: 0
Dołączył: 6.09.2011

Ostrzeżenie: (0%)
-----


Cytat
Kolumna Typ Null Domyślnie Komentarze MIME
id int(11) Nie
title varchar(45) Nie
link varchar(55) Nie
description varchar(255) Nie
type varchar(15) Nie
date datetime Nie
author int(11) Nie


Ten post edytował Pytajka 25.04.2012, 18:01:49
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 26.09.2025 - 04:44