We provide knowledgeable blogs related to php, jQuery, html, css, wordpress, woocommerce, cordova app with examples in 2021.
20 January 2021
How to use ajax in Codeigniter?
How to upload file in codeigniter?
Upload file in Codeigniter?
Paste this code in controller
if($this->input->post('upload_file'))
{
$config['upload_path'] = 'uploads';
$config['allowed_types'] = 'gif|jpg|png';
// $config['max_size'] = 100;
// $config['max_width'] = 1024;
// $config['max_height'] = 768;
$this->load->library('upload', $config);
// $upload_data = $this->upload->data('file_name');
if ( ! $this->upload->do_upload('files'))
{
$error = array('error' => $this->upload->display_errors());
//$this->load->view('upload', $error);
echo 'FIle Error';
}
else
{
$data = array('upload_data' => $this->upload->data());
// $this->load->view('upload', $data);
echo 'FIle Uploaded Successfully';
$upload_name = $this->upload->data('file_name');
}
}
Paste this code in View
<div class="user_update_form">
<form method="post" action="" enctype="multipart/form-data" />
<?php echo validation_errors(); ?>
<?php //echo $error; ?>
<?php echo form_open_multipart('upload/do_upload');?>
<h1 class="register_lable">Upload Files</h1>
<label>Files</label>
<input type="file" class="input_field" name="files" value="">
<input type="submit" name="upload_file" class="upload_file" value="Update">
</form>
</div>
19 January 2021
How to delete data from database in MySql in codeigniter?
Delete data from database in MySql in codeigniter
if($this->input->post('delete_user'))
{
$user_id = $this->input->post('user_id');
$this -> db -> where('ID', $user_id);
$this -> db -> delete('login_form');
redirect(dashboard);
}
How to fetch data from Database in Codeigniter?
Fetch data from Database in Codeigniter
foreach ($query->result() as $row)
{
echo $row->ID.'<br>';
echo $row->name.'<br>';
echo $row->phone.'<br>';
echo $row->email.'<br>';
echo $row->password.'<br><hr>';
}
How to insert data into database in MySql in Codeigniter?
Insert data into the database in MySql in Codeigniter
if($this->input->post('register')){
$name=$this->input->post('person');
$phone=$this->input->post('phone');
$email=$this->input->post('email');
$password=$this->input->post('password');
$data = array(
'name' => $name,
'phone' => $phone,
'email ' => $email,
'password ' => $password
);
$this->db->insert('login_form', $data);
if($this->db->affected_rows() > 0){
echo 'Data inserted successfull';
}else{
echo 'Data Not inserted';
}
}
How to Create table into Database in MySQL in Codeigniter?
Create table into Database in MySQL in Codeigniter
17 December 2020
How to Make Textarea Auto Resize using Javascript?
Make Textarea Auto Resize using Javascript.
<!DOCTYPE html>
<html>
<head>
<title>Textarea Auto Height</title>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
</head>
<body>
<h1>Textarea Auto Height</h1>
<textarea id="resize" style="width: 360px;"></textarea>
<script type="text/javascript">
$('#resize').on('input', function () {
this.style.height = 'auto';
this.style.height = (this.scrollHeight) + 'px';
});
</script>
</body>
</html>
How to create video slider with cuncks of videos without download all videos?
Create video slider with cuncks of videos without download all videos function custom_video_slider_shortcode() { $slider_id = 'vide...
-
Add re-captcha v3 on all Elementor forms using coding add_action('wp_footer',function(){ ?> <script src="https://www...
-
Show shape file (.shp)(map) on map with shape file Include gasparesganga package in php code https://gasparesganga.com/labs/php-shapefile/ ...
-
How to show wordpress error messages in woocommer and wordpress? || wc_add_notice Function if(is_null($user)){ wc_add_notice( 'You...