This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set session data | |
$newdata = array( | |
'username' => 'johndoe', | |
'email' => '[email protected]', | |
'logged_in' => TRUE | |
); | |
$this->session->set_userdata($newdata); | |
unset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CTRL+SHIFT+H will open the replace dialogue where you can find+replace in any or all of your open projects. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git init | |
git add . | |
git commit -m 'message' | |
git push -u origin master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.Data table styling : https://datatables.net/blog/2011-05-10 [28.12.16 ->Apsis] |