Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 12-12-2009, 07:27 AM IF and ???
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Hi

I did this but I think the word AND is wrong here.

Code:
 
<? if ($tl==$tl) AND ($t2==$t2)  echo  "$tl's for Sale in &nbsp;&nbsp;&nbsp;<font face = 'verdana' size = '3' color = '#FF0000'> $t2 </font>"; ?>
I need to assign that the two conditions must be true at the same time.

thanks
josil is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-12-2009, 08:52 AM Re: IF and ???
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
You just got the paranthesis wrong. The and-operator can be written both as '&&' and 'and' (at least I think so, but most people use &&).
PHP Code:
if ($t1 == $t1 && $t2 == $t2) {
   
// do something

Although in your case, you are comparing a variable with itself, $t1 with $t1 and $t2 with $t2, so it will always be true.
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 12-12-2009, 11:22 AM Re: IF and ???
xela1966's Avatar
Super Talker

Posts: 135
Name: Baptista
Location: Alvor, Algarve Portugal
Trades: 0
There is many sites on the internet that show you almost evrithing you need for your code example:
http://php.net/index.php
For what you need:
http://www.w3schools.com/PHP/php_operators.asp
__________________
Algarve Holidays
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
xela1966 is offline
Reply With Quote
View Public Profile Visit xela1966's homepage!
 
Old 12-14-2009, 05:41 PM Re: IF and ??? [RESOLVED ]
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Quote:
Originally Posted by lizciz View Post
You just got the paranthesis wrong. The and-operator can be written both as '&&' and 'and' (at least I think so, but most people use &&).
PHP Code:
if ($t1 == $t1 && $t2 == $t2) {
   
// do something

Although in your case, you are comparing a variable with itself, $t1 with $t1 and $t2 with $t2, so it will always be true.


Thanks a lot
josil is offline
Reply With Quote
View Public Profile
 
Old 12-14-2009, 05:42 PM Re: IF and ??? [RESOLVED]
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Quote:
Originally Posted by xela1966 View Post
There is many sites on the internet that show you almost evrithing you need for your code example:
http://php.net/index.php
For what you need:
http://www.w3schools.com/PHP/php_operators.asp

Thanks a lot
josil is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to IF and ???
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15090 seconds with 12 queries