FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a 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!
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-2007 Frihost, forums powered by phpBB.