On Sat, 2010-07-03 at 16:11 +0200, Hans Åhlin wrote:

> Another thing is that I would use != false, so every value but false passes.
> 
> $objEmploye=new Employe;
>    if ( 
> $objEmploye->insert(array($name,$lastname,$salary,$dui,$afp,$isss,$nit))
> == true){
>        echo 'Saved';
>    }else{
>        echo 'Error, try again';
>    }
> 
> 
> **********************************************
>  Hans Åhlin
>    Tel: +46761488019
>    icq: 275232967
>    http://www.kronan-net.com/
>    irc://irc.freenode.net:6667 - TheCoin
> **********************************************
> 
> 
> 
> 2010/7/3 Carlos Sura <carlos_s...@hotmail.com>:
> >
> >
> > Hello, this function does not work for me... And I really don't know what 
> > am I doing wrong... Any help??
> >
> > This function is in a class, and I call it in a form, to create a new user..
> >
> >
> >
> >    $objEmploye=new Employe;
> >    if ( 
> > $objEmploye->insert(array($name,$lastname,$salary,$dui,$afp,$isss,$nit)) == 
> > true){
> >        echo 'Saved';
> >    }else{
> >        echo 'Error, try again';
> >    }
> > }else{
> >
> >
> >    function insert($field){
> >        if($this->con->connect()==true){
> >            return mysql_query("INSERT INTO employes (name,lastname, salary, 
> > id, afp, isss, nit) VALUES ('".$field[0]."', 
> > '".$field[1]."','".$field[2]."','".$field[3]."','".$field[4]."','".$field[5]."','".$field[6]."')");
> >        }
> >    }
> >
> >
> >
> >
> > Thanks.
> >
> > _________________________________________________________________
> > http://clk.atdmt.com/UKM/go/197222280/direct/01/
> > Do you have a story that started on Hotmail? Tell us now
> 


Actually, removing the '== true' part would do that and result in
shorted code. The mysql_query() function returns different values
depending on the query made, but will only ever be one of 3 values:
true, false, or a mysql resource. In this code example, there is no
difference between '== true' and '!= false'.

Thanks,
Ash
http://www.ashleysheridan.co.uk


Reply via email to