•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 392,047 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,290 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 803 | Replies: 18 | Solved
![]() |
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
Umm..
If the record in the table has more than 2008, for example, some text with it, you can try it this way.
php Syntax (Toggle Plain Text)
if($row['col1'] == "2008") { } //else do nothing
php Syntax (Toggle Plain Text)
<?php $str = "test - 2008 is as boring as 2007"; if(strstr($str,"2008")) { echo "2008 found!"; } else { echo "2008 not found!"; } ?>
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
I just solved it using stristr and then found your solution (never got notified of your message)whats the difference between the functions?
Thanks once again nav.
Thanks once again nav.
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
stristr does the same as strstr. But stristr is case-insensitive. ie.,
Cheers,
Nav
stristr("This is a test","IS"); will return true since "IS" is found in "This". Whereas, strstr("This is a test","IS"); will return false (since "IS" doesn't match with "is"). Cheers,
Nav
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
Ahh ok thanks nav, genious as usual 
On to the next problem XD
If you get a chance to look at my double click problem (requires 2 clicks to be updated) I think that covers everything I require for this project XD

On to the next problem XD
If you get a chance to look at my double click problem (requires 2 clicks to be updated) I think that covers everything I require for this project XD
•
•
Join Date: Jun 2008
Posts: 5
Reputation:
Rep Power: 0
Solved Threads: 0
I read your post above with great interest. I have a phpBB forum and am the most beginning of beginners. I have what seems to me an easy question for someone beyond my "knowledge". I am trying to construct a simple if then else statement that I can wrtie that will test for the "is the user logged in " variable (which I don't know) - test for true or false and allow me to display a guest message.
This is so simple Im a little embarassed (lol) but I would appreciate some help.
Thanks,
This is the "bones" of what I'm trying to.
--------------------------------------------------------------
$logged = variable_name_that contains_login_value
<?php
if $logged = variable_name_that contains_login_value
display welcome/signup banner;
} else {
Do nothing;
}
?>
--------------------------------------------------------------
This is so simple Im a little embarassed (lol) but I would appreciate some help.
Thanks,
This is the "bones" of what I'm trying to.
--------------------------------------------------------------
$logged = variable_name_that contains_login_value
<?php
if $logged = variable_name_that contains_login_value
display welcome/signup banner;
} else {
Do nothing;
}
?>
--------------------------------------------------------------
You should post your problem in a new thread but anyways.
Few minor things wrong with your code:
Hope that helps
Regards, X
Few minor things wrong with your code:
<?php if ($logged == "variable_name_that contains_login_value") display welcome/signup banner; } ?>
Hope that helps
Regards, X
Last edited by OmniX : Jun 4th, 2008 at 11:54 pm.
•
•
Join Date: Jun 2008
Posts: 5
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
You should post your problem in a new thread but anyways.
Few minor things wrong with your code:
<?php if ($logged == "variable_name_that contains_login_value") display welcome/signup banner; } ?>
Hope that helps
Regards, X
Thanks for the reply it is much appreciated. My only remaining questions are:
1. Is the correct name of the variable $logged
2. What values do it contain or return
Thanks again
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
Umm.. There are some things you need to know before 'creating' a variable. A variable can't start with an integer. For example, $123variable is not a valid variable name. More about it here..
http://nl2.php.net/language.variables
And $logged will have the value that you assigned to it. For example,
http://nl2.php.net/language.variables
And $logged will have the value that you assigned to it. For example,
php Syntax (Toggle Plain Text)
<?php $logged = "yes"; if($logged == "no") { echo "Not logged in"; } else { echo "Logged in.."; }
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
- Updated : Simple ASP.Net Login Page (ASP.NET)
- Please check my code below (Java)
- Open In New Window Php (PHP)
- bank system problem !!!! (C++ programming) (C++)
- submiting info into a database for retrieval! (PHP)
- ASP.NET wizard control (ASP.NET)
- Simple ASP.Net Login Page (Using VB.Net) (ASP.NET)
- MYSQL/PHP variable check (MySQL)
- Variable Validation & MYSQL (PHP)
- limiting account names (PHP)
Other Threads in the PHP Forum
- Previous Thread: mysql query results - 0 row count
- Next Thread: issue Posting emails while logging in dotproject with gmail account


Linear Mode