0

For 2-3 years in have been coding in php , then for some time in codeigniter.

Now i want to built some business type application like ERP

and i am confused which language to choose ASP.NET or java

As ASP.NET is growing very rapidly and has large library to do almost anything(I read this on blogpost) on the otherhand java platform indepdent and open source ( I also have some experience i java ) , but don't know how it is feature rich like ASP.NET.

I want to focus mostly on my productivity in business rules rather then setting up cumbersome installtion or steep learning curve to do new things

So Which language do you suggest also I don't have any experience in ASP.NET

5
Contributors
16
Replies
113
Views
3 Years
Discussion Span
Last Post by diafol
Featured Replies
  • 2

    okay guys, I am on break :). it is around 1:18 AM in my time zone and I am just taking the 20/20 break :). Then I will eventually hit my bunk bed.. The purpose of this post is to show my fairness to other languages of choice as mentioned … Read More

  • 1
    diafol 3,720   3 Years Ago

    PHP-knocking is a hard habit to break for some. You can understand that it is based on ignorance in the main, as veedeoo states about PHP's early days. However, I think there's some snobbery about it too. Some of the 'enlightened' have their niches and may be set in their … Read More

  • 1

    Indeed all the above is true, I always try to argue for PHP and personally would NOT consider using anything else. However, the job sections in my local area always seems to be littered with dotnet jobs, they tend to command a higher salary as well. Remember most enterprise systems … Read More

0

There is also an ERP applications written in PHP e.g. epesi, web ERP, and some more here ( not all PHP, but you should be able find PHP.

ASP.net is not a language itself it is a framework that can take VB, C#. It will be your language choice either VB or C#? Which one can you do?

I have no disagreement with the usage of JAVA. IMHO, you choose the language you feel very comfortable with. I am not saying that we should not try or learn other languages, but to built a pretty big project while learning the language just does not equate to successful product.

You have mentioned above that you already have 2-3 years of PHP and some time in CodeIgniter. That alone have already given you enough experienced on how to write high quality codes in PHP.

PHP is much better now than 3 years ago. Also, there is a secret project called PHP New Generation or PHPng. If you haven't heard about it, this is something you might want to research and the latest Hack from facebook.

If I need to choose which language other than PHP, I would go for Python on Django framework. Otherwise, I would rather stay and continue to write application in PHP and wait for the announcement of the big one.

Again, the final choic is yours. I have already given you my opinion on this.

Edited by veedeoo: info added.

0

@veedeoo i want to just focus on my clients. To give them the best solutions they needed to run their business successfully. Do you still recommend me php, i think i php i need to write code for nearly most things and very small things. I told you just want to focus on my productivity.

Is it possible to integrate SAP with php ??

Also i want to integrate crystal reports (I heard about this from my senior) in php. Is that possible ???

and more thing
Is MySQL (which i mostly used along with php) realiable enough for business solutions, which is quite large.

Also consider this i have some experience in java. So Is there any frameworks in java specifically for this purpose.

Edited by Prateek_2

1

Is it possible to integrate SAP with php ??

There was a book entitled SAP Developer's Guide for PHP. PHP can also work with SAP HANA.

Also i want to integrate crystal reports (I heard about this from my senior) in php. Is that possible ???

Yes, all you need to do is install a JavaBridge. I already talked about JavaBridge in one of my post long time ago.

Is MySQL (which i mostly used along with php) realiable enough for business solutions, which is quite large.

For high-end business applicationm, I don't see any limitation on MySQL. However, PDO extension support multitude of databases like
Cubrid
FreeTDS / Microsoft SQL Server / Sybase
Firebird
IBM DB2
IBM Informix Dynamic Server
MySQL 3.x/4.x/5.x
Oracle Call Interface
ODBC v3 (IBM DB2, unixODBC and win32 ODBC)
PostgreSQL
SQLite 3 and SQLite 2
Microsoft SQL Server / SQL Azure
4D

In addition, there are many excellent ORM for PHP e.g. Propel, Doctrine, and another one that I can't remember its name. I know Laravel uses Eloquent, but that's not it though :).

When you were using CodeIgniter, have you tried using the codeIgniter's Active records? That's pretty simple library not even close to the latest ORM, but it can handle some pretty serious loads. How about codeIgniter's transaction table safe?

below is a screenshot of a database with a little more than 1.3 million rows. I tested mysql search with join queries for three tables using the CodeIgniter's Active records. Never have any glitch since I wrote the script. The last time I checked the PhpMyAdmin this database have grown to around 2.1 million rows with 4 tables and 15 columns for each.

4ee8214f58a008a21edcc5a6773353a5

Now, allow me to go back on the subject matter ERP. I mentioned EPESI, because I am currently evaluating it and I have it on my development server. I think the initial pre-packaged tools are good.

Do you still recommend me php, i think i php i need to write code for nearly most things and very small things.

Believe me regardless of what language you choose, you still have to write your own codes, even the little things. I have been writing applications on Django framework, and yet inspite of abundace in ready made modules, I still have to write most of the codes even the little ones. This is pretty normal, because as a developer the buck stops in front of you. When problem arises, you cannot just point your finger to other developers because the module or library have failed in your application.

After what have been said, the final decision is yours. You can choose whatever language you want and it should work for your purpose.

Besides PHP isn't bad after all. Facebook is using PHP ( of course, they added HACK, but the bottom line is that it is still dependent to PHP core). Daniweb is built on CodeIgniter and it is doing pretty well.

Edited by veedeoo: info added.

0

I'm wondering why you're looking to learn a new language if you're just concerned with productivity. Which aspect of PHP is causing you concern? Do you have any particular specifications in mind?

0

Thanks @veedeo for well description and clearing my confusion.

I am going to stick to php.

One last thing codeigniter is enough for large business applications or i need to learn zend or laravel

0

@diafol I heard from my seniors that ASP.NET can do many things from its large library. I need to know, should i switch to java or ASP.NET because i never heard any great organiation ( specifically related to my field ) using php and mysql for thier backend.

1

There are some strenghts that are unique to codeIgniter, Zend, Laravel and many others.

Months ago, we were telling people about the diminishing codeIgniter before the eyes of its creator. However, I was really surprised with the release of the version 2.2.0. So, I guess I can recommend CI again.

For example, let say we have a medium size corporation with 5 different entities. If we want to manage these entities from ONE backend application we can utilize epesi as shown below

3ed5b1ab8a3f84634ef77d88d0f1ab1f

We can make epesi to be the corporate headquarters. We can gather reports, activity logs, trasactions, and all these good stuffs from all the 5 entities.

Now, let us go down to the entities. Let say each of them, have their own products completely different from one another. We want these entities to have their own websites. What framework should we use?

My response is codeIgniter. Why CodeIgniter? Here is why. Let say entity one sells mobile phone, entity two sells shoes, entity three sells outdoor gears, entity four sells furnitures, entity five sells used clothings. Generating a report is not a problem with Epesi, we can pretty much modify the script to accomodate any requrements.

How can achieved this in CI? Actually, this is pretty easy to achived in CI because you can create your on library specific to your needs.

Say we are to create the entity one library

<?php

    class EntityOne{

        public function __construct(){
            $CI =& get_instance();
        }

        public function manage_inventory(){
        }

        public function manage_sales(){
        }

        public function report_to_epesi{
        }

        }

The same construct can be applied to the remaining entities under the corporation.

We can do this in Zend, Cake PHP, Laravel, Kohana, Yii, and others. However, this type of application requires speedy implementations and we don't need any delay. So, the most feasible way in achieving such requirements is to use a framework capable of providing a rapid development environment.

Of course, my recommendation would be completely different if we are to build a health care back-end. I mean something that will not disintegrate on a million queries and requests if you know what I mean. There is one framework that is capable of running on little server resources by compiling the source to C language. I can't think of its name right now.

0

There is one framework that is capable of running on little server resources by compiling the source to C language.

Sounds like phalcon, I was meaning to evaluate that but was put off by the fact it needs to sit on its own dedicated server and that the code was written in c so modding the libs is pretty much out of the question even though I'm more than qualified to write c code.

In regards to the original question... The OP does raise a good point about enterprise systems and this seems to be where the money is... let's be fair.

With perhaps the exception of zend most jobs require dotnet or java (spring) knowledge. If the pay packet is a serious consideration the OP wouldn't go too far wrong switching to dotnet.

As this is a PHP forum of course, your replies are going to be somewhat biased.

0

Sounds like phalcon, I was meaning to evaluate that but was put off by the fact it needs to sit on its own dedicated

There you go Iamthwee. Yes, that was Phalcon, you are right. I can't remember its name, a horse image keep on showing up on my head for memory key, but I am sure the name wasn't from anything like a horse :).

I know I am bit biased :), I am sure if he ever posted his question on the ASP.NET side, I would give the same response utilizing the dotnet showing the strenght of either VB or C# in MVC environment. Since the question is on the PHP side, I need to bring-up some other things that the PHP is capable of outside the echo "Hello World".

The same determination I have, if ever this question was posted on JAVA or Python forum, I will probably have come up with something.

I also put the language what the OP already knows, instead of sending him to go out and learning how to code in JAVA, VB, and C's. The OP wants to have a SAP support and the ERP kind of application. Zend is probably a struggle to be able port to the ERP. The most feasible is to be able to use the OP's previous knowledge in CI and use the ready made ERP called EPESI and just port it to CI.

And of course, OP can effeciently do this in dotnet, JAVA, PYthon, even in Ruby and dotnet, but the learning curve is pretty steep.

Edited by veedeoo: info added.

2

okay guys, I am on break :). it is around 1:18 AM in my time zone and I am just taking the 20/20 break :). Then I will eventually hit my bunk bed..

The purpose of this post is to show my fairness to other languages of choice as mentioned by the Prateek_2. Again, my comparisons are focused on Web applications and I am not taking any desktop application into consideration. Otherwise, this will be covered on the software development forum of which I am also glad if I am given the chance to explain my take between the JAVA and C#. Obviously, I will take both.

Now i want to built some business type application like ERP

I have given him the EPESI

and i am confused which language to choose ASP.NET or java

I have given him examples of PHP based on his requirements. I hope :).

Let's take a brief look at the simple language constructs of these three languages at it applies to Web applications Enterprise or Just a plain personal page. For web applications, JEE (Enterprise edition) is highly favored instead of the regular JSE ( Standard Edition). While for the ASP.net it can be either C# or VB running on RAZOR mark-up Syntax where the full MVC design patterns can be utilized.

The Console Vs. CLI (PHP). Demonstration of a simple Hello World

JAVA

package com.test.model;

public class TestingJava {

    public static void main(String[] args){
        String sayit = ("hello wordl!");
        System.out.println(sayit.toUpperCase() );
    }

}

C# reference for C# construct .

string sayit = "hello world!";
string sayitUp = sayit.ToUpper();
Console.WriteLine(sayitUP.ToString());

PHP

class TestingPhp{

    public function __construct(){}

    public function sayit(){

        echo strtoupper('hello world');

        }

  }

The CLI for PHP ( command line interface to match the same output as seen on the console for the C and the JAVA).

php test.php TestingPhp sayit

all of the above returns

HELLO WORLD!

That's pretty simple huh? Nothing can even fall into the so called learning curve conundrum. I don't see any codes above that are not self-explanatory.

Let's move on to the web applications. In JAVA, we will utilize JetBrains/IntelliJ.

Once again, we will use the same "Hello World" example.

JAVA or JEE

Please read example here. I will just outline some important stuffs.

The beans package the HelloWorldBean class.

package mybeans;

import javax.ejb.Stateless;

@Stateless(name = "HelloWorldEJB")
public class HelloWorldBean {
    public HelloWorldBean() {
    }
    public String sayHello() {
        return "Hello, World!";
    }
}

Where is the constructor of the bean class?

 public HelloWorldBean() {
    }

That is how the class can be initialized in JAVA pretty similar to the wannabe OOP in PHP version 4.x.x as described by the anti-PHP group ( I will briefly talk about this later).

Still referring to the linked sample codes, let's move on to the servlet. Partial codes are shown below.

package myservlets;

import mybeans.HelloWorldBean;

import javax.ejb.EJB;
import java.io.IOException;

In PHP, the import can be safely assumed that it is rather equivalent to include_once, include(), require(), or requirec_once(). Exceptions are built-in in PHP we don't really have to do anyting with that, except when we want an override it as defined by @(exec('do not show this error come what may').

After the servelet file, we have three more files (hello.jsp,application.xml,ejb-jar.xml) needed to make the hello world a beautiful and yet expensive finished product.

Will I recommend this method to anyone? Of course not, PHP can do better than this. If I will be using an enourmous amount of files, I can manage to integrate smarty or twig on my hello world application, and I will get cached and compiled content in return.

I will recommend JAVA only for the purpose of doing something really special tasks behind the scene and in PHP this is possible by using the JAVAbridge extension as they call it.

Let's move on to ASP.net C# on Razor syntax

<html>
<body>

@{ var sayIt = "Hello World"; }

<p>@sayIt</p>

</body>
</html>

Not bad, it looks cool and clean. Pretty much applicable to web.

In PHP,

<html>
<body>
<?php $sayIt = "Hello World"; ?>

<p> <?php echo $sayIt; ?></p>

</body>
</html>

Both of them look pretty cool and nice. Let's move on to the Object Oriented and MVC of PHP and ASP.net

Below is a simple application I wrote in ASP.net just for the benefit of this discussion.

7c45280404ab363d824c36af5e177a03

that is the file structure of my simple application. my controller in C# ASP.net. oh no! Let me do it in VB instead. Only because, I am already tired of writing codes all day long and I hate missing on those curly brackets not even realizing which language I am on c# or PHP :). So to make the comparison a lot clearer, let do this VB.

Here we go VB on Asp.net the controller

Public Class HomeController
Inherits System.Web.Mvc.Controller

Function Index() As ActionResult
    ViewData("Message") = "Hello World!"

    Return View()
End Function

Function About() As ActionResult
    Return View()
End Function

End Class

That's pretty clean also. The model in VB

Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Imports System.Globalization

Public Class ChangePasswordModel
    Private oldPasswordValue As String
    Private newPasswordValue As String
    Private confirmPasswordValue As String

<Required()> _
<DataType(DataType.Password)> _
<Display(Name:="Current password")> _
Public Property OldPassword() As String
    Get
        Return oldPasswordValue
    End Get
    Set(ByVal value As String)
        oldPasswordValue = value
    End Set
End Property

<Required()> _
<StringLength(100, ErrorMessage:="The {0} must be at least {2} characters long.", MinimumLength:=6)> _
<DataType(DataType.Password)> _
<Display(Name:="New password")> _
Public Property NewPassword() As String
    Get
        Return newPasswordValue
    End Get
    Set(ByVal value As String)
        newPasswordValue = value
    End Set
End Property

<DataType(DataType.Password)> _
<Display(Name:="Confirm new password")> _
<System.Web.Mvc.Compare("NewPassword", ErrorMessage:="The new password and confirmation password do not match.")> _
Public Property ConfirmPassword() As String
    Get
        Return confirmPasswordValue
    End Get
    Set(ByVal value As String)
        confirmPasswordValue = value
    End Set
End Property
End Class

Public Class LogOnModel
    Private userNameValue As String
    Private passwordValue As String
    Private rememberMeValue As Boolean

<Required()> _
<Display(Name:="User name")> _
Public Property UserName() As String
    Get
        Return userNameValue
    End Get
    Set(ByVal value As String)
        userNameValue = value
    End Set
End Property

<Required()> _
<DataType(DataType.Password)> _
<Display(Name:="Password")> _
Public Property Password() As String
    Get
        Return passwordValue
    End Get
    Set(ByVal value As String)
        passwordValue = value
    End Set
End Property

<Display(Name:="Remember me?")> _
Public Property RememberMe() As Boolean
    Get
        Return rememberMeValue
    End Get
    Set(ByVal value As Boolean)
        rememberMeValue = value
    End Set
End Property
End Class

Public Class RegisterModel
Private userNameValue As String
Private passwordValue As String
Private confirmPasswordValue As String
Private emailValue As String

<Required()> _
<Display(Name:="User name")> _
Public Property UserName() As String
    Get
        Return userNameValue
    End Get
    Set(ByVal value As String)
        userNameValue = value
    End Set
End Property

<Required()> _
<DataType(DataType.EmailAddress)> _
<Display(Name:="Email address")> _
Public Property Email() As String
    Get
        Return emailValue
    End Get
    Set(ByVal value As String)
        emailValue = value
    End Set
End Property

<Required()> _
<StringLength(100, ErrorMessage:="The {0} must be at least {2} characters long.", MinimumLength:=6)> _
<DataType(DataType.Password)> _
<Display(Name:="Password")> _
Public Property Password() As String
    Get
        Return passwordValue
    End Get
    Set(ByVal value As String)
        passwordValue = value
    End Set
End Property

<DataType(DataType.Password)> _
<Display(Name:="Confirm password")> _
<System.Web.Mvc.Compare("Password", ErrorMessage:="The password and confirmation password do not match.")> _
Public Property ConfirmPassword() As String
    Get
        Return confirmPasswordValue
    End Get
    Set(ByVal value As String)
        confirmPasswordValue = value
    End Set
End Property
End Class

Ouch! that's a lot of stuff to learn for someone who never coded in VB or C#. Let alone the MVC and OOP construct learning curve.

The view, remember in ASP.net MVC, the views can have their own directory which is also available for CI. My login view

@ModelType veedeoomvc_cs.LogOnModel

@Code
    ViewData("Title") = "Log On"
End Code

<h2>Log In</h2>
<p>
    Please provide your user name and password. @Html.ActionLink("Register", "Register") if you don't have an account.
</p>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@Html.ValidationSummary(True, "Login was unsuccessful. Please correct the errors and try again.")

@Using Html.BeginForm()
    @<div>
        <fieldset>
            <legend>Account Information</legend>

        <div class="editor-label">
            @Html.LabelFor(Function(m) m.UserName)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(Function(m) m.UserName)
            @Html.ValidationMessageFor(Function(m) m.UserName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(Function(m) m.Password)
        </div>
        <div class="editor-field">
            @Html.PasswordFor(Function(m) m.Password)
            @Html.ValidationMessageFor(Function(m) m.Password)
        </div>

        <div class="editor-label">
            @Html.CheckBoxFor(Function(m) m.RememberMe)
            @Html.LabelFor(Function(m) m.RememberMe)
        </div>

        <p>
            <input type="submit" value="Log On" />
        </p>
    </fieldset>
</div>
End Using

ASP.net ends here.

Please take a look at the codes above and tell me which one is a lot easier to digest compared to a similar application I just made up a while ago in codeIgniter.

my controller in codeIgniter. By the way this one is a fully loaded controller. It has messaging system, inbox function, inbox message delete through ajax, registration, login, and login validation. It is ported with Smarty template engine. It also includes a simple dashboard function the length of codes is pretty much the same as the model on my ASP.net VB codes above.

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Users extends CI_Controller { 

private $attributes = array('class' => 'omb_loginForm" autocomplete="off');
private $credentials_at = array('class' => 'form-horizontal');
private $privacy_at = array('class'=>'form-horizontal');
private $inbox_at = array('class'=>'form-horizontal');


public function __construct(){
        parent::__construct();
    /*
    * define the smarty settings
    *
    */
    $this->smarty->smarty_options( 1 , false, 3600 , '{% ',' %}');
    $this->smarty->registerPlugin("modifier",'base64_decode', 'base64_decode');
    $this->load->library('form_validation');

    //$this->load->model('register_model');
        $this->load->helper(array('form','url','passwordhash'));

}

/*
* validate login credentials
*/

function validate_login()
{   
    /*
    * load the application/models/members_model.php
    */
    $this->load->model('Members_model');

    $user = $this->input->post('user_name');
    $pass = ($this->input->post('password'));


    if($this->Members_model->validate_user($user, $pass))
    {


        redirect('users/dashboard', 'refresh');
    }
    else // incorrect username or password
    {
        $data['message_error'] = TRUE;
        $this->set_form($form_error= TRUE);

    }
}

/*
* this is the default login page
*/

public function index()
{
    if($this->session->userdata('is_logged_in')){
        redirect('users/dashboard','refresh');
    }

    else{

        $this->set_form($form_error= FALSE);
    }
}
public function set_form($form_error = FALSE){

                $this->smarty->assign(array(
                                        'form'=> form_open('users/validate_login',$this->attributes),
                                        'form_submit'=>form_submit('submit', 'Login', 'class="btn btn-large btn-primary"'),
                                        'form_input' =>form_input('user_name', '', 'placeholder="Username" class="form-control"'),
                                        'form_chkbox'=>form_checkbox('remember_me','remember-me', FALSE),
                                        'form_password'=>form_password('password', '', 'placeholder="Password" class="form-control"'),
                                        'form_close'=>form_close(),
                                        'form_error'=> $form_error,//FALSE,//((isset($message_error) && $message_error) ? TRUE : FALSE),
                                        'anchor' => anchor('users/register_member', 'Register'),
                                        'forgot' => anchor('users/forgot_pass', 'Forgot Password?'),
                                        'base_url'=> base_url()
                                        ));
            $this->smarty->view('userlogin');



}

/*
* @ create member 
* process registration
* add to database, redirect to member's default page
*/

function register_member(){

    $this->load->library('form_validation');
    $errors = array();

    /*
    * is_unique[Database_Name:Column_Name]
    * validation ('field_name','error_message','validation_rules')
    */

    $this->form_validation->set_rules('first_name', 'Name', 'required|trim|xss_clean|max_length[255]|alpha_numeric');
    $this->form_validation->set_rules('last_name', 'Last Name', 'trim|required|xss_clean|max_length[255]|alpha_numeric');
    $this->form_validation->set_rules('email_address', 'Email Address', 'trim|required|valid_email|is_unique[users.email_address]');
    $this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[4]|is_unique[users.user_name]');
    $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]|max_length[32]');
    $this->form_validation->set_rules('password_confirmation', 'Password Confirmation', 'trim|required|matches[password]');
    $this->form_validation->set_rules('terms','Terms and Conditions Checkbox', 'required');

    if($this->form_validation->run() == FALSE)
    {
    $errors['errors'] = $this->form_validation->set_err();

        $this->load->view('registration_form',$errors);

    }

    else
    {           
        $this->load->model('Members_model');
        $form_data = array(
            'first_name' => $this->input->post('first_name'),
            'last_name' => $this->input->post('last_name'),
            'email_address' => $this->input->post('email_address'),         
            'user_name' => $this->input->post('username'),
            'pass_word' => create_pass($this->input->post('password')),
            'privs' => 100 //regular members    
        );

        if($this->Members_model->create_member('users',$form_data))
        {
            //$this->load->view('users/signup_successful'); 
                //$this->registration_success();
                redirect('users/registration_success','refresh');
        }
        /*
        else
        {
            $this->load->view('registration_form',$errors);     
        }
        */
    }

}

/*
*@registration success
* redirect user to success page
*/

public function registration_success(){
                //var_dump($this->session->set_userdata());
                $this->smarty->assign(array(
                    'base_url'=> base_url(),

                ));
                $this->smarty->view('success');

}

/*
* users dashboard functions
*/

public function dashboard(){

            $this->load->library('Myveedeoocms');

            if($this->session->userdata('is_logged_in')){

            $inbox_data = $this->mycms->get_inbox($this->session->userdata('user_id'));

            //print_r($inbox_data[0]);
            $unread_msg = $this->mycms->get_unread($this->session->userdata('user_id'));

            $this->smarty->assign(array(
                                        'user_data'=>$this->session->all_userdata(),
                                        'base_url' =>base_url(),
                                        'user_settings'=> ($this->load_user_settings() ? $this->load_user_settings() : FALSE),
                                        'user_info'=>$this->Members_model->get_user($this->session->userdata('user_name')),
                                        'credential_form' => form_open('users/change_password',$this->credentials_at),
                                        'privacy_form' => form_open('users/update_privacy', $this->privacy_at),
                                        'inbox_form' => form_open('users/compose_message',  $this->inbox_at),
                                        'inbox_count'=> $inbox_data[1],
                                        'inbox_msg' => $inbox_data[0],
                                        'unread_msg_count'=>$unread_msg[1]
                                    ));

                    $this->smarty->view('userdashboard');



            }

            else{
                redirect('users/validate_login','refresh');

            }

}

public function load_user_settings(){
                $this->load->model('Members_model');
                $u_setting = array();

                if($u_settings = $this->Members_model->get_user_settings($this->session->userdata('user_id'))){

                        return($u_settings);

                }
                else{


                        if($this->Members_model->set_user_settings('acct_settings',$this->session->userdata('user_id'))){
                            return($this->Members_model->get_user_settings($this->session->userdata('user_id')));   

}
/*
* update privacy settings
*/
public function update_privacy(){

    $this->load->model('Members_model');
    //$data = array();
    $user_data = array();
    $name_f = array('allow_invite','share_image','share_files','share_videos','forward_pm','allow_pm');

if($this->input->post()){
    foreach($name_f as $x){

    $user_data[''.$x.''] = ($this->input->post(''.$x.'') && ($this->input->post(''.$x.'') == 'on') ? 'yes' : 'no' );
    //$data[] = $user_data;

    }

$this->Members_model->update_user_settings('acct_settings', array_filter($user_data) , $this->session->userdata['user_id'] );
    redirect('users/dashboard#account','refresh');

}


}

/*
* load user inbox
*/

public function load_inbox(){

        $this->load->model('Members_model');

}
public function compose_message(){
        $form_data = array(
            'first_name' => $this->input->post('first_name'),
            'last_name' => $this->input->post('last_name'),         
            'user_name' => $this->input->post('username'),
            'msg_receiver' => $this->input->post('reciever'),
            'msg' => $this->input->post('message'),
            'date' => date()    
        );



}
public function delete_msg(){

    $this->load->library('Mycms');

    if($_GET['id']){

        if($this->mycms->ajax_delete($_GET['id'])){

            echo ("Message Deleted");

        }


    }



}

public function logout(){

    $this->session->sess_destroy();
    redirect('users');
}

}

The model. Here I will be demonstrating 3 database queries. The CI native mysql, my own PDO extension and the CI Active Records. If I wasn't too tired for the day, I can demonstrate the Doctrine ORM, but it is just too much typing for me already. My brain can go on and on, but my fingers are just too lazy to type.

 <?php

class Members_model extends CI_Model {

public function __construct(){
    parent::__construct();
    $this->load->library('session');
    $this->load->helper('passwordhash');
}

public function get_user($user){

            $dbFilters= "id_user,first_name,last_name,email_address,user_name, pass_word";
            $userQuery = ("SELECT ". $dbFilters ."  FROM `users` WHERE user_name='$user'") ;

            $res = $this->pdoclass->get_item($userQuery);
            return $res[0];
}

public function set_user_settings($table_name,$user_id){

        $form_data = array(
                    'm_id' => $user_id,

                    'share_image'=>1,
                    'share_videos'=>1,
                    'share_files' =>1,
                    'allow_pm' => 1
        );
        if($this->pdoclass->insert($table_name, $form_data)){


                return TRUE;
        }
}

public function validate($user_name, $password){

    $this->db->where('user_name', $user_name);
    $this->db->where('pass_word', $password);
    $query = $this->db->get('membership');

    if($query->num_rows == 1)
    {
        return true;
    }       
}

public function validate_user($user,$password){


    $username = self::get_user($user);
    if(strtolower(trim($username['user_name']))== strtolower(trim($user)) && (password_verify($password, $username['pass_word']))){
    /*
    * assign some account info. in session
    */
            $sess_data = array(
               'user_id' => $username['id_user'],
               'user_name'  => $username['user_name'],
               'email'     => $username['email_address'],
               'logged_in' => TRUE,
               'is_logged_in' => true
                            );
            $this->session->set_userdata($sess_data);



    return TRUE;
    }
    else{
    return FALSE;

    }
}

public function get_db_session_data()
{
    $query = $this->db->select('user_data')->get('ci_sessions');
    $user = array(); /* array to store the user data we fetch */
    foreach ($query->result() as $row)
    {
        $udata = unserialize($row->user_data);
        /* put data in array using username as key */
        $user['user_name'] = $udata['user_name']; 
        $user['is_logged_in'] = $udata['is_logged_in']; 
    }
    return $user;
}


public function create_member($table_name,$data=array())
{

        if($this->pdoclass->insert($table_name, $data)){
                //echo 'success';
                $member_id = $this->pdoclass->insert($table_name, $data);
                $member_id = $member_id[1];

                return TRUE;
        }



}

public function get_user_settings($user)
{

            $userQuery = ("SELECT *  FROM `acct_settings` WHERE m_id='$user'") ;
            $res = $this->pdoclass->get_item($userQuery);
            return $res[0];
}

public function update_user_settings($table, $data, $user_id){

        if($this->pdoclass->update_db($table, $data, "m_id='".$user_id."'")){

            return true;

        }
}

}

Now, it is up to the OP which language he thinks will be easy for him.

** My final thoughts: **
PHP was the most ranted language in the past. The reason is that it was really bad in the beginning. Not even suited for OOP.

Most colleges and Universities don't even teach PHP/MySQL. In my home state California, there is only one college that can really teach PHP/MySQL and it is located near Silicon Valley. While most Universities will only teach you with JAVA, C++, C#, Databases, design patterns, algorithm and then to the Javascript if you want to go for the Information Technology with web option.

Some other schools are offering bad PHP/MySQL courses, but all of them are taught by the JAVA people, and most of the time, these so called professors don't even realized that the while loop in PHP/mysql queries don't need an incremental i as counter to track how many rows has been reiterated. Only very few of them would mention the Object oriented side of PHP. This explains why some questions here at the forum still uses the native MysQL.

I also love JAVA, ASP.net, the three Cs, Python, Ruby . I could have contributed more in other forums, but I am just so darn lazy in participating.

I am more active in PHP forum, because it is the most criticized language. Most people who have Bachelors of this,** a Master of that**, and PHD of all of those believe that PHP is a poor choice even in delivering dynamic pages. Recently, I participated on a live online discussion that was held in linkedIn . A professor from one of the most prestigious University here in the U.S. was one of the guest of honor chatter. The moment he started typing about PHP, he already lost the respect I have for him. Why? because his judgement was based on the relic version of PHP. If I will be teaching something or commenting on something in the presence of young programmer, I will give it my best effort to search for the latest news about the language I am about to comment on.

If the claims of these so called highly educated are true, why then the Objects I presented above are equally good? The only decision the OP has to make is which language will give him the comfort zone.

If they did not critized the creator of the PHP-GTK until the project is nearl out of breath, then the project could have continue until today. I mean common now, Cairo is not even close to what was originally planned.

1

PHP-knocking is a hard habit to break for some. You can understand that it is based on ignorance in the main, as veedeoo states about PHP's early days. However, I think there's some snobbery about it too. Some of the 'enlightened' have their niches and may be set in their ways. Their livelihoods after all revolve around other technologies or languages (probably Java - not stereotyping hopefully).

The fact that megamonsters like Facebook are using PHP (albeit with Hack), should dispell the bullshit floating around its suitability. I think their comments often speak more about themselves than the technology that they profess to know so much about. This is dangerous territory for them, as it seems to underline how little they know about their chosen field. My 2p.

Edited by diafol

1

Indeed all the above is true, I always try to argue for PHP and personally would NOT consider using anything else. However, the job sections in my local area always seems to be littered with dotnet jobs, they tend to command a higher salary as well.

Remember most enterprise systems have already been built using dotnet or java and require someone to come onboard to help maintain or enhance said system.

If you're considering this as a profession it is important to take these points into consideration.

BTW nice post veedeo. It's good to know you're encouraged by the latest version of codeigniter. I hold your opinion very highly. All my systems I've built sit on CI. I've not experienced any issues or inflexibilities thus far.

0

@everyone I have no problem learning a new language. As iamthwee pointed out most enterprise systems have already been built using dotnet or java.

Even Most companies in my locality not using php, mysql. and i don't want to redesign their system just because i know php.

So suggest my clearly which lang should i focus on.

I just want to make their business solution great

here are the points i want to focus
RAD
I want to only focus on business logic mostly
Great User Interface

0

Prateek what you're effectively asking for is a crystal ball answer. Sorry but noone here can say with 100% certainty that you should opt for one over the other.

We can offer our experience but java developers will give you java biased answers, similar with dotnet. It's really difficult for me to separate my opinion as I am strongly tied to PHP but I've looked at the existing market and certainly in my neck of the woods dotnet appears the front runner.

Again there's no certainty with learning dotnet, as a proprietary language microsoft could change the goal posts any time.

What I would do if I were you is to sit down and write on a piece of paper your experiences with dotnet and java. Figure out which you are leaning towards but most importantly, look at your job market. Are there more jobs available in dotnet?

Is the starting salary something you're OK if?

Last but not least, at least from my experience, sometimes it doesn't even matter which language you like more...

You go for a java job interview and if you get the job and the pay is nice... Guess what, you'll learn to like it and suddenly your initial decisions won't matter so much.

In any programming field it is less about which language you know but more about how you go about problem solving and this is what most companies seek out much more than anything else.

Good luck fella.

0

So suggest my clearly which lang should i focus on.

No such answer is possible as already pointed out. You seem to know about the number of jobs in each language in your area and probably beyond, so I don't know what we could tell you that you couldn't find out for yourself. It seems that you have placed yourself between the .net and java camps. Although other languages may be in demand for certain niche areas, they certainly won't compete with the big 3 opportunities-wise. I'm thinking of Python and Ruby, maybe even ColdFusion. However, numbers can be a tricky. Quantity does not always relate to good starting salaries or ease of entry. However, there's plenty of data out there on these too. Funnily enough I was talking to a guy at dinner tonight who is a project manager in a software wing of a firm and he was telling me how difficult it was to recruit good .net developers. He stated a starting salary of £35K just outside the Cardiff (capital city), UK area.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.