Welcome Guest, Not a member yet? Register   Sign In
Database troubles
#1

[eluser]Maglok[/eluser]
There is a current bug that makes the profiler not display queries if you are running PHP 4 (which I am). I use active records to build my query, but I am getting errors.

I have 3 tables basically:
- personen
- inschrijvingen
- evenementen

inschrijvingen has both a persoon_id and a evenement_id, creating a unique pair. I want to select all the 'personen' that are in 'inschrijvingen' with a evenement_id that I give. So I wrote this:

Code:
$this->db->select('personen.voornaam, personen.tussenvoegsel, personen.achternaam, inschrijvingen.type');
$this->db->from('personen, inschrijvingen');
$this->db->where('inschrijvingen.evenement_id', $_GET['id']);
$this->db->where('inschrijvingen.persoon_id', 'personen.persoon_id');
$this->db->order_by('personen.achternaam','asc');
$query = $this->db->get();*/

If I try to call any of the data I get issues like:
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: achternaam
Filename: views/inschrijven_lijst.php
Line Number: 37

I tried putting the query directly in phpMyAdmin using this:

Code:
SELECT personen.voornaam, personen.achternaam, personen.tussenvoegsel, inschrijvingen.type
FROM personen, inschrijvingen
WHERE inschrijvingen.persoon_id = personen.persoon_id
AND inschrijvingen.evenement_id = 1

It selected no problem. I'd normally run the profiler but it is suffering from the bug, I am trying to find out just what query I am building with the active record.


Messages In This Thread
Database troubles - by El Forum - 06-23-2009, 05:56 AM
Database troubles - by El Forum - 06-23-2009, 06:13 AM
Database troubles - by El Forum - 06-23-2009, 06:15 AM
Database troubles - by El Forum - 06-23-2009, 06:17 AM
Database troubles - by El Forum - 06-23-2009, 06:43 AM
Database troubles - by El Forum - 06-23-2009, 06:48 AM
Database troubles - by El Forum - 06-23-2009, 06:58 AM
Database troubles - by El Forum - 06-24-2009, 07:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB