Welcome Guest, Not a member yet? Register   Sign In
Database LiveSearch
#21

[eluser]sanir[/eluser]
Code:
function getSearchResults(value) {
   $.post("http://localhost/crm/index.php/search/getSearchResults",{partialSearch:value}, function(data){
    $("#search_results").html(data);
   });
  }

try this code.
#22

[eluser]joe.afusco[/eluser]
Still internal server error.
#23

[eluser]sanir[/eluser]
open this url in browser then tell me what happen.

http://localhost/crm/index.php/search/getSearchResults
#24

[eluser]joe.afusco[/eluser]
I receive the following error:


( ! ) Parse error: syntax error, unexpected T_OBJECT_OPERATOR in C:\wamp\www\crm\application\controllers\search.php on line 17

line 17 refers to the db query

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Search extends CI_Controller {


public function index()
{
  
}

public function getSearchResults()
{
  $this->load->database();  
  $partialSearch = $_POST['partialSearch'];
  $query = $this->db->select('email_address')
  ->like('email_address', $partialSearch);
  ->get('users');
  
  $result = $query->result();
  $data = "";
  foreach($result as $row){
     $data = $data . "<div>" . $row->email_address . "</div>";
  }
  echo $data;
}
}

#25

[eluser]sanir[/eluser]
Code:
&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Search extends CI_Controller {


public function index()
{
  
}

public function getSearchResults()
{
  $this->load->database();  
  $partialSearch = $_POST['partialSearch'];
  $query = $this->db->select('email_address');
  ->like('email_address', $partialSearch);
  ->get('users');
  
  $result = $query->result();
  $data = "";
  foreach($result as $row){
     $data = $data . "<div>" . $row->email_address . "</div>";
  }
  echo $data;
}
}

try this code
#26

[eluser]joe.afusco[/eluser]
Internal server error.

parse error still the same, except line 16.

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in C:\wamp\www\crm\application\controllers\search.php on line 16
#27

[eluser]sanir[/eluser]
http://localhost/crm/index.php/search/getSearchResults

use this url and give me complete errror.
#28

[eluser]joe.afusco[/eluser]
Complete error:

( ! ) Parse error: syntax error, unexpected T_OBJECT_OPERATOR in C:\wamp\www\crm\application\controllers\search.php on line 16
Call Stack
# Time Memory Function Location
1 0.0006 700368 {main}( ) ..\index.php:0
2 0.0018 793176 require_once( 'C:\wamp\www\crm\system\core\CodeIgniter.php' ) ..\index.php:202
#29

[eluser]sanir[/eluser]
Code:
&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Search extends CI_Controller {


public function index()
{
  
}

public function getSearchResults()
{
  $this->load->database();  
  $partialSearch = $_POST['partialSearch'];
  $this->db->select('email_address');
  $this->db->like('email_address', $partialSearch);
  $query = $this->db->get('users');
  
  $result = $query->result();
  $data = "";
  foreach($result as $row){
     $data = $data . "<div>" . $row->email_address . "</div>";
  }
  echo $data;
}
}

try this code
#30

[eluser]joe.afusco[/eluser]
Internal server error.

A PHP Error was encountered

Severity: Notice

Message: Undefined index: partialSearch

Filename: controllers/search.php

Line Number: 14




Theme © iAndrew 2016 - Forum software by © MyBB