Anonymous
Nicht in der Lage, von Controller zu CODEGIGRIER anzeigen zu anzeigen
Post
by Anonymous » 17 Feb 2025, 06:31
Hallo, ich versuche, Ergebnisse von Controller zu zeigen, um in Codesigniter anzuzeigen. Ich hole die Ergebnisse vom Modell zu Controller und zeige dann die zu map- und in Div. Ich möchte auch in Div anzeigen, was nicht funktioniert. Hier ist mein Code.
Code: Select all
function getRegaddress($citycheck,$lat,$lng,$itemid,$hotelid) {
$return =array();
// Here goes Query....
//$query = mysql_query($results);
if ($query->num_rows() >0) {
foreach ($query->result() as $row) {
array_push($return, $row);
}
// return $query->result();
}
return $return;
}
}
< /code>
Hier der Controller -Code < /p>
$data = $this->maps_model->getRegaddress($citycheck,$lat,$lng,$itemid,$hotelid);
$data['hotelname'] = $hotelname;
$config['center'] = $lat.",".$lng;
$this->load->library('googlemaps');
$this->googlemaps->initialize($config);
foreach ($data as $coordinate) {
// $data = array();
// $data['values']=$coordinate->hotelname;
$marker = array();
$marker['title'] = $coordinate->hotelname;
$marker['position'] = $coordinate->lat.','.$coordinate->lng;
$this->googlemaps->add_marker($marker);
}
$data = array();
$data['map'] = $this->googlemaps->create_map();
$this->load->view('templates/_header');
$this->load->view('content/temp-view', $data);
$this->load->view('templates/footer');
< /code>
Code anzeigen < /p>
[url=menu/] [/url]
< /code>
Im Ergebnis ... Die Kartenmarkierung zeigt die Details aus der Datenbank an. Aber wenn ich den Delalername auf dem Div anzeigeSeverity: Notice
Message: Trying to get property of non-object
Filename: controllers/mapcontrol.php
Line Number: 84
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: controllers/mapcontrol.php
Line Number: 84
< /code>
Warum bekomme ich diesen Fehler? Jeder weiß, bitte helfen Sie ... < /p>
Hier ist die Struktur der Ausgabe < /p>
array(3) { [0]=> object(stdClass)#23 (15) { ["hotelid"]=> string(1) "2" ["hoteltype"]=> string(1) "3" ["hotelname"]=> string(18) "Sreekrishna food" ["dealerloc"]=> string(27) "Bengaluru, Karnataka, India" ["lat"]=> string(18) "12.971598700000000" ["lng"]=> string(18) "77.594562699999980" ["dealercity"]=> string(9) "Bengaluru" ["dealeraddress"]=> string(27) "Bengaluru, Karnataka, India" ["type"]=> string(2) "ar" ["stype"]=> string(3) "ggs" ["email"]=> string(15) "local@gmail.com" ["mobile"]=> string(10) "9947485214" ["phone"]=> string(10) "9947485214" ["website"]=> string(0) "" ["distance"]=> string(22) "0.00005899369716644287" } [1]=> object(stdClass)#24 (15) { ["hotelid"]=> string(1) "3" ["hoteltype"]=> string(1) "3" ["hotelname"]=> string(15) "Aey food" ["dealerloc"]=> string(42) "Shivaji Nagar, Bengaluru, Karnataka, India" ["lat"]=> string(18) "12.985650300000000" ["lng"]=> string(18) "77.605692699999960" ["dealercity"]=> string(13) "Shivaji Nagar" ["dealeraddress"]=> string(42) "Shivaji Nagar, Bengaluru, Karnataka, India" ["type"]=> string(2) "ar" ["stype"]=> string(3) "ggs" ["email"]=> string(9) "std@ff.il" ["mobile"]=> string(10) "9947485214" ["phone"]=> string(10) "9947485214" ["website"]=> string(0) "" ["distance"]=> string(18) "1.2265085392649464" } [2]=> object(stdClass)#25 (15) { ["hotelid"]=> string(1) "1" ["hoteltype"]=> string(1) "3" ["hotelname"]=> string(17) "Super - foods" ["dealerloc"]=> string(47) "FM Cariappa Colony, Bengaluru, Karnataka, India" ["lat"]=> string(18) "12.977923000000000" ["lng"]=> string(18) "77.612083499999930" ["dealercity"]=> string(18) "FM Cariappa Colony" ["dealeraddress"]=> string(47) "FM Cariappa Colony, Bengaluru, Karnataka, India" ["type"]=> string(2) "ar" ["stype"]=> string(3) "ggs" ["email"]=> string(11) "ddd@gfgf.in" ["mobile"]=> string(10) "9947485214" ["phone"]=> string(10) "9947485214" ["website"]=> string(12) "www.music.in" ["distance"]=> string(18) "1.2580702750661623" } }
1739770318
Anonymous
Hallo, ich versuche, Ergebnisse von Controller zu zeigen, um in Codesigniter anzuzeigen. Ich hole die Ergebnisse vom Modell zu Controller und zeige dann die zu map- und in Div. Ich möchte auch in Div anzeigen, was nicht funktioniert. Hier ist mein Code.[code]function getRegaddress($citycheck,$lat,$lng,$itemid,$hotelid) { $return =array(); // Here goes Query.... //$query = mysql_query($results); if ($query->num_rows() >0) { foreach ($query->result() as $row) { array_push($return, $row); } // return $query->result(); } return $return; } } < /code> Hier der Controller -Code < /p> $data = $this->maps_model->getRegaddress($citycheck,$lat,$lng,$itemid,$hotelid); $data['hotelname'] = $hotelname; $config['center'] = $lat.",".$lng; $this->load->library('googlemaps'); $this->googlemaps->initialize($config); foreach ($data as $coordinate) { // $data = array(); // $data['values']=$coordinate->hotelname; $marker = array(); $marker['title'] = $coordinate->hotelname; $marker['position'] = $coordinate->lat.','.$coordinate->lng; $this->googlemaps->add_marker($marker); } $data = array(); $data['map'] = $this->googlemaps->create_map(); $this->load->view('templates/_header'); $this->load->view('content/temp-view', $data); $this->load->view('templates/footer'); < /code> Code anzeigen < /p> [url=menu/] [/url] < /code> Im Ergebnis ... Die Kartenmarkierung zeigt die Details aus der Datenbank an. Aber wenn ich den Delalername auf dem Div anzeigeSeverity: Notice Message: Trying to get property of non-object Filename: controllers/mapcontrol.php Line Number: 84 A PHP Error was encountered Severity: Notice Message: Trying to get property of non-object Filename: controllers/mapcontrol.php Line Number: 84 < /code> Warum bekomme ich diesen Fehler? Jeder weiß, bitte helfen Sie ... < /p> Hier ist die Struktur der Ausgabe < /p> array(3) { [0]=> object(stdClass)#23 (15) { ["hotelid"]=> string(1) "2" ["hoteltype"]=> string(1) "3" ["hotelname"]=> string(18) "Sreekrishna food" ["dealerloc"]=> string(27) "Bengaluru, Karnataka, India" ["lat"]=> string(18) "12.971598700000000" ["lng"]=> string(18) "77.594562699999980" ["dealercity"]=> string(9) "Bengaluru" ["dealeraddress"]=> string(27) "Bengaluru, Karnataka, India" ["type"]=> string(2) "ar" ["stype"]=> string(3) "ggs" ["email"]=> string(15) "local@gmail.com" ["mobile"]=> string(10) "9947485214" ["phone"]=> string(10) "9947485214" ["website"]=> string(0) "" ["distance"]=> string(22) "0.00005899369716644287" } [1]=> object(stdClass)#24 (15) { ["hotelid"]=> string(1) "3" ["hoteltype"]=> string(1) "3" ["hotelname"]=> string(15) "Aey food" ["dealerloc"]=> string(42) "Shivaji Nagar, Bengaluru, Karnataka, India" ["lat"]=> string(18) "12.985650300000000" ["lng"]=> string(18) "77.605692699999960" ["dealercity"]=> string(13) "Shivaji Nagar" ["dealeraddress"]=> string(42) "Shivaji Nagar, Bengaluru, Karnataka, India" ["type"]=> string(2) "ar" ["stype"]=> string(3) "ggs" ["email"]=> string(9) "std@ff.il" ["mobile"]=> string(10) "9947485214" ["phone"]=> string(10) "9947485214" ["website"]=> string(0) "" ["distance"]=> string(18) "1.2265085392649464" } [2]=> object(stdClass)#25 (15) { ["hotelid"]=> string(1) "1" ["hoteltype"]=> string(1) "3" ["hotelname"]=> string(17) "Super - foods" ["dealerloc"]=> string(47) "FM Cariappa Colony, Bengaluru, Karnataka, India" ["lat"]=> string(18) "12.977923000000000" ["lng"]=> string(18) "77.612083499999930" ["dealercity"]=> string(18) "FM Cariappa Colony" ["dealeraddress"]=> string(47) "FM Cariappa Colony, Bengaluru, Karnataka, India" ["type"]=> string(2) "ar" ["stype"]=> string(3) "ggs" ["email"]=> string(11) "ddd@gfgf.in" ["mobile"]=> string(10) "9947485214" ["phone"]=> string(10) "9947485214" ["website"]=> string(12) "www.music.in" ["distance"]=> string(18) "1.2580702750661623" } } [/code]