Digital World Freelancer

The Digital World Freelancer group is applying latest Technologies Like HTML, CSS, CSS3, JavaScript, JQuery, PHP and more...... for website designing & developing... reach at our organization http://www.digitalworldfreelancer.com

Facebook Page

Monday, November 2, 2015

How To Create and edit Sub menu in Blogger Templates ( Blog )


How To Remove index.php from Codeigniter Form or contact-us form in email when you click send for action generate

Step:1 :-   Go to application/config/config.php
Step:2:-   Now change
               
               $config['index_page'] = "index.php";

                             into
             
                $config['index_page'] = "";


Step:3:- now go your contact page and refresh it and fill form detail and click on send now you will get url like this---

http://www.yoururl.com/send-email

Note: send-email is in my form_open("send-email", $data);

Transferring your codeIgniter project from local server to live server through Filezilla? know here

If you are new to CodeIgniter MVC framework & want to go live with the project build with CI framework then this guide is for you.

Step1: If you developed database driven website on your local server then you have to create the database for your live site also. You can create the MySQL database from your web hosting control panel.

Step2:  Connect to your website ftp server with any reliable ftp client software (like filezilla) & transfer all project files from local server to live server.

Step3: Open the database configuration file located at “/config/database.php” inside your codeigniter project & change the database access code with your online website database information:

$db[‘default’][‘hostname’] = “localhost“;

$db[‘default’][‘username’] = “root“;

$db[‘default’][‘password’] = “123456“;

$db[‘default’][‘database’] = ” your_project_db“;

Step4: Open the configuration file located at ”/config/config.php” inside your codeigniter project & change the base_url with live URL:

$config[‘base_url’]     = “http://localhost/yourprojectdir/“;

This should be like this:

$config[‘base_url’]     = “http://www.yourdomain.com“;

Step5: It’s done. Now check all page links & functionality of your website from http://www.yourdomain.com

*** Note: If are facing 404 errors then check the following:

If you use .htaccess file for your project then check it again to make sure URL rewriting code is correct for your live server & your server has mod_rewrite enable.
Remove all hard code URL link from view, controller files if any & always Use base_url() instead of hard code URL link to project.

Thursday, October 29, 2015

How to Rewriting URL in Codeigniter from http://www.example.com/users/services/ into http://www.example.com/services

Codeigniter URL Rewriting
mostly we need to rewrite URLs to provide user friendly URLs of projects.
In CodeIgniter its much simple rather than manual writing HTAccess Rules.
Suppose you have :
Controller (users)
Function (index) list of all users
Function (add) add user
Function (view) view user
Function (update) update user information
Function (delete) delete user
Normally URLs will be :
www.example.com/users/index/
www.example.com/users/add/
www.example.com/users/view/
www.example.com/users/update/
www.example.com/users/delete/
But you want that URLs should be:
www.example.com/users/
www.example.com/add-user/
www.example.com/view-user/
www.example.com/update-user/
www.example.com/delete-user/
You do not need to add HTAccess rules in CodeIgnitor.
Just go to /application/config/routes.php
Aprx line 42
add following lines:
$route['users'] = “users/index/”;
$route['add-user'] = “users/add/”;
$route['view-user'] = “users/view/”;
$route['update-user'] = “users/update/”;
$route['delete-user'] = “users/delete/”;
That’s All.
Now you can update your hyperlinks and rewrite rules will be done.
You open path www.example.com/add-user/
it will be opened www.example.com/users/add/

How to redirect from a page into another page when condition is true or false in Codeigniter?

Use the redirect() function from the URL Helper.
EDIT: load the url helper:
Example:-
$this->load->helper('url');
if (condition == TRUE) {
   redirect('new_page');
}
Example:-
Use redirect() helper function.

Example :

$this->load->helper('url');

if ($logged_in == FALSE)
{
     redirect('/login/form/', 'refresh');
}

Contact Page (Form Helper), form Validation and Send Email in Codeigniter

Step:1


Step:2

Step:3

how to rewrite URL From like About_us to about-us this is like - SEO Friendly URLs in Codeigniter

For rewrite URL From like About_us to about-us this is like - SEO Friendly URLs

Step:1:-  Go in your codeigniter project =>   project folder/application/config/routes.php
Step:2:-  $route['translate_uri_dashes'] = False;

so write TRUE in place of False in routes.php here $route['translate_uri_dashes'] = False;

and now refresh your project:

example:- projectname/about_us into projectname/about-us

Friday, September 11, 2015

PHP and MySQL with MySQLi: Introduction (Part 1/9)


Database Connection in PHP and Mysqli with OOPs concept

<?php
class Connect{
public $hostname = 'localhost';
public $username = 'root';
public $password = '';
public $database = 'test';
public $db;
public function conn(){
$db = new mysqli($this->hostname, $this->username, $this->password, $this->database);
if($db->connect_errno){
echo "database connection error found";
}else
                                               {
echo "database connect successfully!";
}
}
}

$conn = new Connect();
$conn->conn();
   
?>

Output: database connect successfully!

Wednesday, August 12, 2015

PHP 5 MySQLi Functions - Useful for PHP Developer


Function
Description
Returns the number of affected rows in the previous MySQL operation
Turns on or off auto-committing database modifications
Changes the user of the specified database connection
Returns the default character set for the database connection
Closes a previously opened database connection
Commits the current transaction
Returns the error code from the last connection error
Returns the error description from the last connection error
Opens a new connection to the MySQL server
Adjusts the result pointer to an arbitrary row in the result-set
Performs debugging operations
Dumps debugging info into the log
Returns the last error code for the most recent function call
Returns a list of errors for the most recent function call
Returns the last error description for the most recent function call
Fetches all result rows as an associative array, a numeric array, or both
Fetches a result row as an associative, a numeric array, or both
Fetches a result row as an associative array
Returns meta-data for a single field in the result set, as an object
Returns the next field in the result set, as an object
Returns an array of objects that represent the fields in a result set
Returns the lengths of the columns of the current row in the result set
Returns the current row of a result set, as an object
Fetches one row from a result-set and returns it as an enumerated array
Returns the number of columns for the most recent query
Sets the field cursor to the given field offset
Returns the position of the field cursor
Frees the memory associated with a result
Returns a character set object
Returns the MySQL client library version
Returns statistics about client per-process
Returns the MySQL client library version as an integer
Returns statistics about the client connection
Returns the MySQL server hostname and the connection type
Returns the MySQL protocol version
Returns the MySQL server version
Returns the MySQL server version as an integer
Returns information about the most recently executed query
Initializes MySQLi and returns a resource for use with mysqli_real_connect()
Returns the auto-generated id used in the last query
Asks the server to kill a MySQL thread
Checks if there are more results from a multi query
Performs one or more queries on the database
Prepares the next result set from mysqli_multi_query()
Returns the number of fields in a result set
Returns the number of rows in a result set
Sets extra connect options and affect behavior for a connection
Pings a server connection, or tries to reconnect if the connection has gone down
mysqli_prepare()
Prepares an SQL statement for execution
Performs a query against the database
Opens a new connection to the MySQL server
Escapes special characters in a string for use in an SQL statement
mysqli_real_query()
Executes an SQL query
mysqli_reap_async_query()
Returns the result from async query
Refreshes tables or caches, or resets the replication server information
Rolls back the current transaction for the database
Changes the default database for the connection
Sets the default client character set
mysqli_set_local_infile_default()
Unsets user defined handler for load local infile command
mysqli_set_local_infile_handler()
Set callback function for LOAD DATA LOCAL INFILE command
Returns the SQLSTATE error code for the last MySQL operation
Used to establish secure connections using SSL
Returns the current system status
Initializes a statement and returns an object for use with mysqli_stmt_prepare()
mysqli_store_result()
Transfers a result set from the last query
Returns the thread ID for the current connection
Returns whether the client library is compiled as thread-safe
mysqli_use_result()
Initiates the retrieval of a result set from the last query executed using the mysqli_real_query()
mysqli_warning_count()
Returns the number of warnings from the last query in the connection