473,387 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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;
}
Jul 17 '05 #1
11 3529

On 9-Jan-2004, Matthew Robinson <ma*************@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 ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #2
In article <pa****************************@hotmail.com>,
ma*************@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/
Jul 17 '05 #3
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?
Jul 17 '05 #4

On 9-Jan-2004, Matthew Robinson <ma*************@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 ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #5
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;
}

Jul 17 '05 #6
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 =--
Jul 17 '05 #7
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 {
Jul 17 '05 #8
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 =--
Jul 17 '05 #9

On 9-Jan-2004, Matthew Robinson <ma*************@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 ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #10
PHP use the keyword "return" for returning a value from a function. And
variables are not global by default. Hence:

function textsearch($the_items_description)
{
global $search_for;

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

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

or shorter:

function textsearch($the_items_description)
{
global $search_for;

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

return ($pos !== false);
}

or shorter still:

strstr($the_items_description, $search_for);

Uzytkownik "Matthew Robinson" <ma*************@hotmail.com> napisal w
wiadomosci news:pa****************************@hotmail.com...
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;
}

Jul 17 '05 #11
I noticed that Message-ID: <pa****************************@hotmail.com>
from Matthew Robinson contained the following:
$search_for = "is";
$the_items_description = "this is where the description would go";
if (textsearch($item_category)) == true {
echo ("correct");
} else {
echo ("incorrect");
}


well you know it should be

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

now, but for this test did you not perhaps mean to write

$item_category = "this is where the description would go";
if (textsearch($item_category == true)) {...}
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: titi | last post by:
Question The road and traffic authority for a small country currently uses a system to store information about all 'currently' licensed drivers. A licensed driver has the following info stored...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
1
by: tangus via DotNetMonster.com | last post by:
Hello all, I'm really struggling with getting some Active Directory code to work in ASP.NET. Can you please provide assistance? I am executing the following code: Dim enTry As DirectoryEntry =...
4
by: Enrika | last post by:
Greetings! I'm working on a CSS drop-down menu, which, to my surprise, is actually working, more-or-less, in both IE *and* Firefox (and Netscape). But there are two changes that I want to make that...
5
by: garfy | last post by:
Hi i get this error in validation Line 22 column 6: document type does not allow element "title" here. <title>Seo Web Design Los Angeles - Web Design And Search Engine Optimization L ...
0
by: deacon57 | last post by:
FYI - If you are a computer scientist (or geek), this post may be for you. I wanted to log any search keywords, etc that are used on my site. I created a simple program that logs search terms...
16
by: shapper | last post by:
Hello, I have a generic list as follows: Dim rows As New Generic.List(Of row) Now I have a row: Dim myRow As row I tried to check, further in my code, if the row is nothing: If myRow Is...
19
by: foolsmart2005 | last post by:
I have written a snake game. There are 2 levels in the game(I finished 1st level). It can run in VC++ without problem but, when I run it on the dev C++ 4.9.9.2, it cannot run. I want to...
1
by: Drelus | last post by:
I'm using an Ajax call to open a search box in the page and I want the focus to go to the box automatically. So, in the httpObject.responseText, I tried sending the following in addition to the...
2
by: swethak | last post by:
hi , i write the code in .htm file. It is in cgi-bin/searches/one.htm.In that i write a form submitting and validations.But validations are not worked in that .htm file. I used the same code in my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.