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
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();
}
set session data
$newdata = array(
'username' => 'johndoe',
'email' => '[email protected]',
'logged_in' => TRUE
);
$this->session->set_userdata($newdata);
unset
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"
$('#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');
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.
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){
CTRL+SHIFT+H will open the replace dialogue where you can find+replace in any or all of your open projects.
git init
git add .
git commit -m 'message'
git push -u origin master
https://github.com/verot/class.upload.php/blob/master/README.md
$foo = new Upload($_FILES['form_field']);
if ($foo->uploaded) {
// save uploaded image with no changes
$foo->Process('/home/user/files/');
if ($foo->processed) {
echo 'original image copied';
} else {
echo 'error : ' . $foo->error;
1.Data table styling : https://datatables.net/blog/2011-05-10 [28.12.16 ->Apsis]