Subversion-Projekte lars-tiefland.ci

Revision

Revision 1209 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1137 lars 1
<?php
2
 
3
/**
4
 *
5
 * @package WebanOS CI
6
 * @author Lars Tiefland <ltiefland@gmail.com>
7
 * @copyright 2016
8
 * @version $Rev: 1210 $
9
 */
10
 
11
class Artikel_to_bestellung_model extends CI_Model
12
{
13
	public function __construct()
14
	{
15
		parent::__construct();
16
	}
17
 
18
	public function get($id)
19
	{
1208 lars 20
		$sql = "SELECT
1207 lars 21
				`database`
22
			FROM
23
				shops s
24
			JOIN
25
				Bestellung b
26
			ON
27
				s.id=b.shops_ID
1209 lars 28
			WHERE
29
				b.id=".$id."
1207 lars 30
		";
31
		$res = $GLOBALS['order_db']->query($sql);
32
		$row = $res->unbuffered_row('array');
33
		$database = $row['database'];
1137 lars 34
		$artikel = array();
35
		$sql = "SELECT
1207 lars 36
				ab.*,
37
				a.Father
1137 lars 38
			FROM
1207 lars 39
				artikel_to_Bestellung ab
40
			JOIN
1210 lars 41
				".$database.".artikel a
1207 lars 42
			ON
43
				a.id=ab.artikel
1137 lars 44
			WHERE
45
				bestellung = ".$id."
46
		";
47
		$res = $GLOBALS['order_db']->query($sql);
1144 lars 48
		while ($row = $res->unbuffered_row('array'))
1137 lars 49
		{
1144 lars 50
			$artikel[] = $row;
1137 lars 51
		}
52
		return $artikel;
53
	}
54
 
55
}
56
 
57
?>