Skip to content

Instantly share code, notes, and snippets.

View mahbub-shohag's full-sized avatar

Mahbub Alam Shohag mahbub-shohag

  • Jagannath university
  • Mohammadpur,Dhaka
View GitHub Profile
CTRL+SHIFT+H will open the replace dialogue where you can find+replace in any or all of your open projects.
jquery part
$('#registration_form').on('submit',function(e){
e.preventDefault();
var datastring = $(this).serialize();
$.ajax({
method : "GET",
url : "<?php echo base_url(); ?>Main/submit_registration_form",
data: {datastring:datastring}
})
.done(function(msg){
You must add these two lines just after selecting the database, i.e mysql_select_db() function.
mysql_query(‘SET CHARACTER SET utf8’);
mysql_query(“SET SESSION collation_connection =’utf8_general_ci'”);
After executing these two statements MySQL will handle the rest.
$('#registration_form').on('submit',function(e){
e.preventDefault();
var datastring = $(this).serialize();
$.ajax({
method : "GET",
url : "ajax_registration.php",
data: {datastring:datastring}
})
.done(function(msg){
$('#registration_alert').css('display','block');
delete the .htaccess file from root directory.add new .htaccess file with these codes.
RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1
//find the below code
$config['index_page'] = "index.php"
set session data
$newdata = array(
'username' => 'johndoe',
'email' => '[email protected]',
'logged_in' => TRUE
);
$this->session->set_userdata($newdata);
unset
1.One way to get data from database in entity framework to use sql query the syntex is given below :
public ActionResult Animals(int id)
{
var animals = db.Animals.SqlQuery("select * from dbo.Animals where FoodId =1").ToList();
return View();
}
TIPS :
--To add any folder / directory in asp.net mvc project one should not copy and past the directory in the project directly like in php.One must
add a folder in the directory manually and the add classes by adding existing item.otherwise the project will not know the folder and there
will arise issues.
NID : 19925917411000133
Birth : 199905917406013044
BICC : https://erecruitment.bcc.gov.bd/exam/dashboard/dashboard
Date Picker :
1.to embed jquery datepicker firstly add the following jquery files in header part
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
<script src="~/Scripts/jquery-3.2.1.js"></script>
<script src="~/Scripts/jquery-ui-1.12.1.js"></script>
2.<script>
$(document).ready(function () {
$('#PossibleStartDate').datepicker(); --this is the id field of the datefield
$('#PossibleEndDate').datepicker();
$('#PossibleEndDate').on('leave', function () {