I'm using FX.php together with Codeigniter to access a Filemaker DB. Library and config file are autoloaded in config/autoload.php.
This setup works perfectly well on my development machine (OS X, PHP 5.3.14). However, when I run the project on our dev server (Ubuntu Precise, PHP 5.3.10), it doesn't work. There seems to be an issue with the config parameters not being passed to the library. I get the following error messages:
Severity: Notice
Message: Undefined index: dataServer
Filename: libraries/CIFX.php
Line Number: 9
Severity: Notice
Message: Undefined index: dataPort
Filename: libraries/CIFX.php
Line Number: 9
Severity: Notice
Message: Undefined index: dataType
Filename: libraries/CIFX.php
Line Number: 9
Severity: Notice
Message: Undefined index: dataURLType
Filename: libraries/CIFX.php
Line Number: 9
My libraries/CIFX.php file looks like this:
require('FX.php');
class CIFX extends FX {
function __construct ($params = array())
{
parent::__construct($params['dataServer'], $params['dataPort'], $params['dataType'], $params['dataURLType']);
}
}
?>
My config/CIFX.php file looks like this:
$config['dataServer'] = '192.168.1.10';
$config['dataPort'] = '80';
$config['dataType'] = 'FMPro7';
$config['dataURLType'] = '';
$config['dbuser'] = '';
$config['dbpassword'] = '';
According to the Codeigniter manual, this should be working.
Any help much appreciated!
you need to be Passing Parameters When Initializing Your Class
$params = array(
'dataServer' => $this->config->item('dataServer');,
'dataPort' => $this->config->item('dataPort');
);
$this->load->library('CIFX ', $params);
Related
There's something weird going on with server-side Datatables from this: https://github.com/n1crack/Datatables.
Don't understand what's going on, i do exactly the same thing as the examples but it simply doesn't work. According to the "where" example https://github.com/n1crack/Datatables/blob/master/public/examples/where/ajax.php, look how simple it should be:
$dt = new Datatables(new MySQL($config));
$dt->query("Select film_id as fid, title, description from film where film_id > 47 and film_id < 83");
echo $dt->generate();
My code:
$config = [ 'host' => 'localhost',
'port' => '3306',
'username' => 'root',
'password' => '',
'database' => 'sys_db_gincana' ];
$dt = new Datatables( new MySQL($config) );
$dt->query("
SELECT seen, id, name, cep, date_format(created,'%d/%m/%Y %h:%i:%s') as created
FROM user
");
echo $dt->generate();
Now look at what my js console prints from my ajax:
A PHP Error was encountered
Severity: 4096 Message: Argument 1 passed to
PHPSQLParser\builders\WhereBuilder::build() must be of the type array,
boolean given, called in C:\Program Files
(x86)\EasyPHP-DevServer-14.1VC11\data\localweb\projects\gincana\vendor\greenlion\php-sql-parser\src\PHPSQLParser\builders\SelectStatementBuilder.php
on line 74 and defined Filename: builders/WhereBuilder.php
Line Number: 112
A PHP Error was encountered
Severity: Warning Message: Invalid argument supplied for
foreach() Filename: builders/WhereBuilder.php Line
Number: 114
A PHP Error was encountered
Severity: 4096 Message: Argument 1 passed to
PHPSQLParser\builders\WhereBuilder::build() must be of the type array,
boolean given, called in C:\Program Files
(x86)\EasyPHP-DevServer-14.1VC11\data\localweb\projects\gincana\vendor\greenlion\php-sql-parser\src\PHPSQLParser\builders\SelectStatementBuilder.php
on line 74 and defined Filename: builders/WhereBuilder.php
Line Number: 112
A PHP Error was encountered
Severity: Warning Message: Invalid argument supplied for
foreach() Filename: builders/WhereBuilder.php Line
Number: 114
Fatal error: Call to a member function
fetch_assoc() on a non-object in C:\Program Files
(x86)\EasyPHP-DevServer-14.1VC11\data\localweb\projects\gincana\vendor\ozdemir\datatables\src\DB\MySQL.php
on line 40
And if if i change the query to:
$dt = new Datatables( new MySQL($config) );
$dt->query("
SELECT seen, id, name, cep, date_format(created,'%d/%m/%Y %h:%i:%s') as created
FROM user
WHERE approved = 0 and canceled = 0
");
echo $dt->generate();
the error changes:
A PHP Error was encountered
Severity: Warning Message: array_merge(): Argument #2 is
not an array Filename: src/Datatables.php Line Number:
47
Fatal error: Call to a member function
fetch_assoc() on a non-object in C:\Program Files
(x86)\EasyPHP-DevServer-14.1VC11\data\localweb\projects\gincana\vendor\ozdemir\datatables\src\DB\MySQL.php
on line 40
Well, the library is a bit new (january 2015), i wonder if someone that had success using it could help me.
Regards
The problem in the WhereBuilder comes from the PHPSQLParser, can you test the latest version from https://github.com/greenlion/PHP-SQL-Parser? It seems to be a simple SQL statement, so actually it should work. I have moved your issue to GitHub, please follow the changes there.
How can I retrieve data from the database by querying records between two dates using codeigniter?
Here is my code :
function date_employee_details($id,$fdate,$sdate)
{
$this->db->select('*');
$this->db->where('user_id',$id);
$this->db->where('dates >=',$fdate);
$this->db->where('dates <=',$sdate);
return $this->db->get('attendance');
}
but i got an error :
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: fdate
Filename: models/admin.php
Line Number: 726
thanks
A PHP Error was encountered
Severity: Notice
Message: Undefined index: elements_id
Filename: views/showdetail.php
Line Number: 17
Help me please!
Error on server openshift but Run on localhost no error.
How to fix?
Do this with each variable
$elements_id=isset($row['elements_id'])?$row['elements_id']):'';
You are trying to use the vale of the index of the array without checking first if is set
<?php
print_r($dataelements);
foreach ($dataelements as $row) {
$elements_id =$row['elements_id'];
$elements_number = $row['elements_number'];
$elements_name = $row['elements_name'];
$elements_principle = $row['elements_principle'];
$elements_standard = $row['elements_standard'];
$elements_indicator = $row['elements_indicator'];
}
?>
trying to make some dynamic combobox and found some troubles..
here's the code
controller
$this->load->model('main_model');
$data['sales'] = $this->main_model->getSales();
$this->load->view('dashboard_view',$data);
the model
$this->db->select('*');
$this->db->from('salesman');
$this->db->where('cabangid',$cabangid);
$this->db->order_by('salesmanid','ASC');
$array_keys_values = $this->db->get();
foreach ($array_keys_values->result() as $row)
{
$result[0]= '- sales-';
$result[$row->salesmanid]= $row->description;
}
return $result;
the view
<div id="sales" style="width:250px;float:left;">
sales: <br/>
<?php
echo form_dropdown("salesmanid",$sales,"","id='salesmanid'");
?>
the error are like these..
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: sales
Filename: views/dashboard_view.php
Line Number: 14
and
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: helpers/form_helper.php
Line Number: 331
any help would be appreciated..:D
trying to get every post and comment from a facebook page, I made this function that should go through the pagination:
$req = $facebook->api("/" . $pagename . "/?fields=posts.fields(message,link,created_time,shares,likes,comments)");
function parcours_arbre($ab)
{
GLOBAL $facebook;
GLOBAL $pagename;
$next = create_request($ab['posts']['paging']['next']);
$next_req = $facebook->api($pagename.$next);
$ab_next = $next_req['data'];
$prev = create_request($ab['posts']['paging']['previous']);
$prev_req = $facebook->api($prev);
$ab_prev = $prev_req['data'];
if (empty($ab)) {
display_results($ab['posts']['data']);
} else {
parcours_arbre($ab_next);
parcours_arbre($ab_prev);
}
}
I unfortunately get the following error:
Notice: Undefined index: posts in /form.php on line 36
Notice: Undefined offset: 3 in /utils.php on line 20
Notice: Undefined offset: 4 in /utils.php on line 20
Fatal error: Uncaught GraphMethodException: Unsupported get request. thrown in /sdk/src/base_facebook.php on line 1271
Any idea how i could avoid it or what is going on? Would this go away if i use the "until" statement in my api request?
Thanks a lot,
To explain each error
the variable $ab which is an argument to the function, does not have a "posts" index. You should try to var_dump this variable so you can see what it actually looks like.
same as above
same as above
the api function takes 3. The path which should just be #pagename. The method ("GET" or "POST") most likely POST because GET is causing an error. The parameters, which should be array("fields" => "posts.fields(message,link,created_time,shares,likes,comments)")
I noticed that for next you have the code
$next_req = $facebook->api($pagename.$next);
but for previous you have
$prev_req = $facebook->api($prev);
Might want to look into this.