Re: [phplib] (Kein Thema) From: Stephen Woodbridge (woodbri <email protected>)
Date: 06/09/01

Also, if you intended mysql_result(...) == "%Ein%" to be a wildcard
comparison it IS NOT. You can only use % as a wildcard in your SQL LIKE
clause. If you intented to compare with the literal "%Ein%" then it is
OK.

If you need to do a wildcard comparision of the result then you must do
something like:

ereg("Ein|Doppel", mysql_result(...)) would return true if "Ein" or
"Doppel" were in the mysql_result(...)

-Steve

Forrest J Cavalier III wrote:
>
> >
> > I tried to do:
> > $ObjTyp1 = array('"%Ein%"' , '"%Doppel%"');
> > $string1 = implode(" or ", $ObjTyp1);
> > <input type=radio name="ObjArt" value="Wohn" <? echo (mysql_result($result,0,
> > "ObjArt")==$string1)?"checked":""; ?>>Wohnh&auml;user</td>
> >
> > and it doesn't work,
> >
> > but when I do:
> >
> > <input type=radio name="ObjArt" value="Wohn" <? echo (mysql_result($result,0,
> > "ObjArt")== "%Ein%" or "%Doppel%" )?"checked":"";?>>Wohnh&auml;user</td>
> >
> They are not the same. Look at where the quotes are.
>
> (mysql_result($result,0, "ObjArt")== "%Ein%" or "%Doppel%" )
>
> is always true. You are using the low precedence operator
> "or", so PHP runs it as:
>
> ((mysql_result($result,0, "ObjArt")== "%Ein%")
> or
> "%Doppel%" )
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: phplib-unsubscribe <email protected>
> For additional commands, e-mail: phplib-help <email protected>

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>