FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP - checking lengths





Ben
Hello,

I need a bit of help with something.

I have just built a search script on my site, and I need a little PHP script that will check that the search is more than 5 letters long.

Any help is much appreciated Smile

EDIT**

I also need help with something else. I have some html for a page that is stored in a mysql db. it also has some PHP in it. When i 'select' this data, and display it on a page, the PHP is not processed. How can I get the PHP to be processed that has been selected from a database?

Thanks!,
Ben
Stubru Freak
Ben wrote:
Hello,

I need a bit of help with something.

I have just built a search script on my site, and I need a little PHP script that will check that the search is more than 5 letters long.

Any help is much appreciated Smile

EDIT**

I also need help with something else. I have some html for a page that is stored in a mysql db. it also has some PHP in it. When i 'select' this data, and display it on a page, the PHP is not processed. How can I get the PHP to be processed that has been selected from a database?

Thanks!,
Ben


First:
Code:
if(strlen($theString) <= 5){
// ERROR
}

(You said more then 5 letters, so that's six or more, if you meant 5 or more just change the <= into <)

Second:
Don't have an idea
Best suggestion I have is to write it in a file using these functions and then including it. But there gotta be a better way.
kv
Try "eval()" method. Check this url http://us3.php.net/eval for documentation.
Ben
Quote:
if(strlen($theString) <= 5){
// ERROR
}

Thanks for that Stubru Freak! That was exactly what I was looking for.

Quote:
Try "eval()" method. Check this url http://us3.php.net/eval for documentation.


Even though it may be poor coding, I used

Code:
<?php
eval (" ?>
$content
<? "); } ?>


Which worked fine. So thanks as well kv!
Related topics
Checking if ports are up using PHP
Checking server status (ports) using PHP
Great php editor
[php scripts ] phpweather&email
How To : Secure Your PHP Website
Tutorial: PHP Installed Modules Dynamic Reference Tool
"Forms To Go" create scripts in PHP, ASP and Perl
PHP
PHP VS ASP
one line securing of php pages (login of users) (user auth)
php+mysql password / login screen
Need help with PHP script[RESOLVED]
Do you know any PHP framework
Email checking and log in
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.