/    Sign up×
Community /Pin to ProfileBookmark

A Simple Keyword Search

Hey, I am having problems with a simple Keyword Search I am developing. Here is the source(once i get this working, I will make it use user input, rather than a set variable):

[code=php]<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
</head>

<body>
<?php
$keyword[0] = “2”;

$keyword[1] = “candystand”;
$title[1] = “Candystand”;
$link[1] = “http://www.candystand.com/”;

$keyword[2] = “miniclip”;
$title[2] = “Miniclip”;
$link[2] = “http://www.miniclip.com/”;

$Query = “miniclip”;

for($i=1; $i <= $keyword[0]; $i++)
{
if($Query == $keyword[$i])
{
$Found = true;
print(“<a href='”);
print($keyword[i]);
print(“‘>”);
print($title[i]);
print(“</a>n”);
}
}
if(!$Found)
{
print(“Not found!”);
}
?>
</body>
</html>[/code]

Here is the page where it is located: [url]http://216.36.173.149/keysearch.php[/url]

As you can see, the PHP is generating the link, but it isn’t filling in the ‘href’ field nor the link text? Anyone able to help me here? Thanx in advance,
-Dan

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@pyroMar 21.2004 — You forgot the $ before the i variable for $keyword[$i] and $title[$i]. ?
Copy linkTweet thisAlerts:
@Daniel_TauthorMar 21.2004 — *takes a bat and whacks myself on the head* I am so stupid!!!:p Thanx Pyro!!!

-Dan
Copy linkTweet thisAlerts:
@pyroMar 21.2004 — No problem. ?

[b]edit:[/b] Setting your [url=http://us4.php.net/error-reporting]error reporting[/url] level to E_ALL would help you out, if your server doesn't display them by default.
Copy linkTweet thisAlerts:
@Daniel_TauthorMar 21.2004 — [i]Originally posted by pyro [/i]

[B][b]edit:[/b] Setting your [url=http://us4.php.net/error-reporting]error reporting[/url] level to E_ALL would help you out, if your server doesn't display them by default. [/B][/QUOTE]

Ok, so to do this, I add [FONT=courier new]error_reporting(E_ALL);[/FONT] to the beggining of the PHP part of my page? Or do I put this in my httpd.conf file?

-Dan
Copy linkTweet thisAlerts:
@pyroMar 22.2004 — Yes, you put it at the beginning of your PHP script. Though if your running your own server, you may prefer to just set it in the php.ini file. There's a section on error reporting that allows you to set your level. I prefer to know when my scripts have problems, so I have error reporting set to E_ALL in my php.ini file.
Copy linkTweet thisAlerts:
@Daniel_TauthorMar 22.2004 — OK! Thanx [b]again[/b] Ryan!

-Dan
Copy linkTweet thisAlerts:
@pyroMar 22.2004 — Happy to help. ?
×

Success!

Help @Daniel_T spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...