problem writing text search function

This is a discussion on problem writing text search function within the PHP Language forums, part of the PHP Programming Forums category; i get "Parse error: parse error in /home/houseproudlancs_co_uk/search.php on line 65" when i open the ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-09-2004
Matthew Robinson
 
Posts: n/a
Default problem writing text search function

i get "Parse error: parse error in /home/houseproudlancs_co_uk/search.php
on line 65" when i open the page, line 65 would be the line that starts
with if (textsearch

$search_for = "is";
$the_items_description = "this is where the description would go";
if (textsearch($item_category) == true {
echo ("correct");
} else {
echo ("incorrect");
}


function textsearch($the_items_description)
{

$pos = strpos($the_items_description, $search_for);

if ($pos === false) {
textsearch = false;
} else {
textsearch = true;
}
Reply With Quote
  #2 (permalink)  
Old 01-09-2004
Tom Thackrey
 
Posts: n/a
Default Re: problem writing text search function


On 9-Jan-2004, Matthew Robinson <mattyrobinson69@hotmail.com> wrote:

> i get "Parse error: parse error in /home/houseproudlancs_co_uk/search.php
> on line 65" when i open the page, line 65 would be the line that starts
> with if (textsearch
>
> $search_for = "is";
> $the_items_description = "this is where the description would go";
> if (textsearch($item_category) == true {
> echo ("correct");
> } else {
> echo ("incorrect");
> }


You need another ) on the if

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to jamesbutler@willglen.net (it's reserved for spammers)
Reply With Quote
  #3 (permalink)  
Old 01-09-2004
Boyd
 
Posts: n/a
Default Re: problem writing text search function

In article <pan.2004.01.09.20.48.56.405332@hotmail.com>,
mattyrobinson69@hotmail.com says...
> i get "Parse error: parse error in /home/houseproudlancs_co_uk/search.php
> on line 65" when i open the page, line 65 would be the line that starts
> with if (textsearch
>
> $search_for = "is";
> $the_items_description = "this is where the description would go";
> if (textsearch($item_category) == true {



2 open brackets and only on closed.


--
**************************************
The Eldritch Dark:
Dedicated to Clark Ashton Smith
http://www.eldritchdark.com/
Reply With Quote
  #4 (permalink)  
Old 01-09-2004
Matthew Robinson
 
Posts: n/a
Default Re: problem writing text search function

that didn't help unfortunately (please forgive me for the VB coder type
error - im used to VB wiping my bum for me) any other idea's?
Reply With Quote
  #5 (permalink)  
Old 01-09-2004
Tom Thackrey
 
Posts: n/a
Default Re: problem writing text search function


On 9-Jan-2004, Matthew Robinson <mattyrobinson69@hotmail.com> wrote:

> that didn't help unfortunately (please forgive me for the VB coder type
> error - im used to VB wiping my bum for me) any other idea's?


consider quoting whatever the hell you are referring to and what you did and
what the new problem is.



--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to jamesbutler@willglen.net (it's reserved for spammers)
Reply With Quote
  #6 (permalink)  
Old 01-09-2004
Pedro Graca
 
Posts: n/a
Default Re: problem writing text search function

Matthew Robinson wrote:
> that didn't help unfortunately (please forgive me for the VB coder type
> error - im used to VB wiping my bum for me) any other idea's?


>>> if (textsearch($item_category) == true {

_______^__________^______________^________________ __________ ???????

where did you put the missing ")"?
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Reply With Quote
  #7 (permalink)  
Old 01-09-2004
Matthew Robinson
 
Posts: n/a
Default Re: problem writing text search function

the original problem was i get "Parse error: parse error in
/home/houseproudlancs_co_uk/search.php on line 65" when i open the page,
line 65 would be the line that starts with if (textsearch

the help suggested was to put the missing ) on the if statement, i have
done this (as below) and it didn't help

$search_for = "is";
$the_items_description = "this is where the description would go";
if (textsearch($item_category)) == true {
echo ("correct");
} else {
echo ("incorrect");
}


function textsearch($the_items_description)
{

$pos = strpos($the_items_description, $search_for);

if ($pos === false) {
textsearch = false;
} else {
textsearch = true;
}

Reply With Quote
  #8 (permalink)  
Old 01-10-2004
Matthew Robinson
 
Posts: n/a
Default Re: problem writing text search function

On Fri, 09 Jan 2004 22:55:12 +0000, Pedro Graca wrote:

> Matthew Robinson wrote:
>> that didn't help unfortunately (please forgive me for the VB coder type
>> error - im used to VB wiping my bum for me) any other idea's?

>
>>>> if (textsearch($item_category) == true {

> _______^__________^______________^________________ __________ ???????
>
> where did you put the missing ")"?



it was
if (textsearch($item_category) == true {

i replaced this with
if (textsearch($item_category)) == true {
Reply With Quote
  #9 (permalink)  
Old 01-10-2004
Pedro Graca
 
Posts: n/a
Default Re: problem writing text search function

Matthew Robinson wrote:
> it was
> if (textsearch($item_category) == true {
>
> i replaced this with
> if (textsearch($item_category)) == true {


And as you've seen that is still wrong.
Try again.

Hint: check the if() syntax
http://www.php.net/manual/en/control...-structures.if
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Reply With Quote
  #10 (permalink)  
Old 01-10-2004
Tom Thackrey
 
Posts: n/a
Default Re: problem writing text search function


On 9-Jan-2004, Matthew Robinson <mattyrobinson69@hotmail.com> wrote:

> if (textsearch($item_category)) == true {


You put the missing ) in the wrong place it should be:

if (textsearch($item_category) == true) {


--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to jamesbutler@willglen.net (it's reserved for spammers)
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:32 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0