I have an error in my project, can you please help me? Here's my code :
$q_cek_login = $this->db->get_where('tbl_karyawan', array('username' => $u, 'password' => $p));
if(count($q_cek_login->result())>0)
{
foreach($q_cek_login->result() as $qck)
{
if($qck->id_jabatan==1)
{
foreach($q_cek_login->result() as $qad)
{
$sess_data['logged_in'] = 'yesGetMeLogin';
$sess_data['username'] = $qad->username;
$sess_data['nama_pengguna'] = $qad->nama;
$sess_data['id_jabatan'] = $qad->id_jabatan;
$this->session->set_userdata($sess_data);
}
//header('location:'.base_url().'pemesanan/pending');
}
}
}
Then I get this error :
A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$id_jabatan
Filename: models/model_digor.php
Line Number: 26
thx u all..........
Please check your dependency class is loaded properly. such as $this->load->library('database'); or $this->load->library('your_built_in_class');
Related
I'm try to call request from web but not working , this code call command game server from website.
class SampRconAPI
{
private $command;
public function __construct()
{
$this->command = $_REQUEST["command"];
}
if($this->command == "cmdlist")
{
$aCommands = $this->packetSend('cmdlist');
unset($aCommands[0]);
foreach($aCommands as &$sCommand)
{
$sCommand = trim($sCommand);
}
return $aCommands;
}
My Error:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: command
Filename: include/SampRcon.php
Line Number: 7
You can rewrite below line:
$this->command = $_REQUEST["command"];
something like this:
$this->command = isset($_REQUEST["command"]) ? $_REQUEST["command"] : "";
So that it won't give you error.
your error made couldn't found command pram on GET request . first check you service configuration is ok .
<?php
$rcon = new SampRconAPI('server_ip', server_port, 'server_rcon_pass');
$rcon->Call('name ' . $playerid_here);
print_r( $rcon->getInfo());
http://forum.sa-mp.com/showthread.php?t=104299
here is example https://gist.github.com/Westie/234209
?>
public function adduser()
{
$this->load->model('User', 'user');
$this->user->adduser();
$data = array('message' => 'Thanks for signing up');
$this->load->view('register', $data);
}
This is my function and it executes perfectly and gives a message of thanks to the register view page. But when I am loading the register view page initially, it gives me an error.
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: message
Filename: views/register.php
Line Number: 15
if anyone can help where it is going wrong.
Regard to the comment section mentioned workaround is
<?php echo ((isset($message)) ? $message : '');?>
Please see ternary operator.
I am still trying to study doctrine so I am following online tutorial by that I could insert data in to a mysql table. like this.
public function createObjects() {
// create a new user object
$user = new Entities\User;
$user->setFirstName('Joel');
$user->setLastName('Verhagen');
$user->setPassword(md5('Emma Watson'));
$this->doctrine->em->persist($user);
$this->doctrine->em->flush();
}
Then I tried to get the data back like this.
public function testing() {
// $user = new Entities\User;
$article = new Entities\Article;
$firstname = $this->doctrine->em->getRepository($article);
$products = $firstname->findAll();
foreach ($products as $product) {
echo sprintf("-%s\n", $product->getContent());
}
}
But I am getting following errors can some one help me on this?
Severity: Warning
Message: ltrim() expects parameter 1 to be string, object given
Filename: ORM/EntityManager.php
Severity: Warning
Message: class_parents(): object or string expected
Filename: Mapping/RuntimeReflectionService.php
Severity: Warning
Message: array_reverse() expects parameter 1 to be array, boolean given
Filename: Mapping/AbstractClassMetadataFactory.php
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: Mapping/AbstractClassMetadataFactory.php
Fatal error: Uncaught exception 'ReflectionException' with message 'Class does not exist' in E:\xampp\htdocs\shoping\application\libraries\Doctrine\Common\Persistence\Mapping\RuntimeReflectionService.php:73 Stack trace: #0 E:\xampp\htdocs\shoping\application\libraries\Doctrine\Common\Persistence\Mapping\RuntimeReflectionService.php(73): ReflectionClass->__construct('') #1 E:\xampp\htdocs\shoping\application\libraries\Doctrine\ORM\Mapping\ClassMetadataInfo.php(867): Doctrine\Common\Persistence\Mapping\RuntimeReflectionService->getClass(NULL) #2 E:\xampp\htdocs\shoping\application\libraries\Doctrine\ORM\Mapping\ClassMetadataFactory.php(517): Doctrine\ORM\Mapping\ClassMetadataInfo->initializeReflection(Object(Doctrine\Common\Persistence\Mapping\RuntimeReflectionService)) #3 E:\xampp\htdocs\shoping\application\libraries\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php(300): Doctrine\ORM\Mapping\ClassMetadataFactory->initializeReflection(Object(Doctrine\ORM\Mapping\ClassMetadata), Object(Doctrine\Common\Pe in E:\xampp\htdocs\shoping\application\libraries\Doctrine\Common\Persistence\Mapping\RuntimeReflectionService.php on line 73
Tried and tried and at last I found a way to go.
public function testing() {
// $user = new Entities\User;
$article = new Entities\Article;
$firstname = $this->doctrine->em->getRepository('Entities\Article');
$products = $firstname->findAll();
foreach ($products as $product) {
echo sprintf("-%s\n", $product->getContent());
}
// $products = $article->getContent();
// echo $products.'fdsf';
}
i have method for uploading image, but i get multiple error messages if i run this method with error:
Severity: Warning
Message: pathinfo() expects parameter 1 to be string, array given
Filename: core/Loader.php
Line Number: 759
Severity: Notice
Message: Array to string conversion
Filename: core/Loader.php
Line Number: 760
An Error Was Encountered
Unable to load the requested file: Array.php
how do I fix the code so as not to get an error ? where is the problem ?
thanks
function upload_image()
{
$config = array(
'file_name'=> 'hallo.jpg',
'upload_path'=>'./application/views/photo',
'allowed_types'=>'gif|jpg|png',
'max_size'=>'1024',
'max_width'=>'1600',
'max_height'=>'1200'
);
$this->load->library('upload', $config);
if($this->upload->do_upload())
{
$data['breadcrumb1'] = "Member";
$data['breadcrumb'] = "Add Member";
$data['content']='admin-cms/member/add';
$this->load->view('admin-cms/index', $data);
}else
{
$data['content']= array('error' => $this->upload->display_errors('<span class="error">','</span>'));
$this->load->view('admin-cms/index', $data);
}
}
For some reason i cant get my model to work.. never had this problem before.
function overview($userid)
{
// Load needed model
$this->load->model('budget_model');
$data['month_budget'] = $this->budget_model->get_monthly_budget($userid);
if(isset($_POST['submit']))
{
foreach($_POST as $key => $value)
{
if(is_numeric($key))
{
$this->buget_model->update_buget($key,$value);
echo "DONE";
}
}
echo "<pre>";
print_r($_POST);
echo "</pre>";
}
$data['main'] = 'super_admin/budget_edit_overview_view';
$this->load->view('default/main_view',$data);
}
The model works fine with "$this->budget_model->get_monthly_budget($userid);" but i keep getting thir error,
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Admin::$buget_model
Filename: controllers/admin.php
Line Number: 166
Fatal error: Call to a member function update_buget() on a non-object
in /Applications/MAMP/htdocs/therace/application/controllers/admin.php
on line 166
The model method,
function update_buget($id,$budget)
{
$this->db->where('id', $id);
// Update the month budget
$data = array(
'month_goal' => $budget
);
$this->db->update('budget_month', $data);
return true;
}
Read the error message carefully:
Message: Undefined property: Admin::$buget_model
Did you make a typo and actually mean $budget_model?
edit: There seems to be a lot of budget vs. buget in your code. I suggest a spellchecker.
You have made a typing error in line 166.
It is $this->budget_model->update_buget($key,$value);
not $this->buget_model->update_buget($key,$value);