I'm creating a search without using mySQL, partly becuz i dont feel like taking the time to figure it out, and another part is that its easier for me to edit my information my way. Well. I finally got my search working..... on my computer... well i go to upload it and then when I search for something one of my variables comes up null instead of what it is suposed to be.
here is my code... i know its a lil shabby and rough... but im still workin on it (the problem is in red):
[FONT=courier new]<?php
$ftitle = "html/title.jss";
$fsidebar = "html/sidebar.jss";
$fbody = "html/body.jss";
$ffooter = "html/footer.jss";
$topen = fopen($ftitle, "r");
$title = fread($topen, filesize/COLOR);
$sopen = fopen($fsidebar, "r");
$sidebar = fread($sopen, filesize/COLOR);
$bopen = fopen($fbody, "r");
$body = fread($bopen, filesize/COLOR);
print "<html>";
print $title;
print $sidebar;
$file = "inventory/item.file";
$open = fopen($file, "r");
$contents = fread($open, filesize/COLOR);
$item = explode( "\n", $contents);
$itemcount = count/COLOR;
$searchwords = $_GET[ "keywords"];
$p=0;
$s=0;
for ($a=0;$a<$itemcount;$a++)
{
$x=0;
$value[$a] = explode( ":", $item[$a]);
$keywordcount = count/COLOR;
[B]for[/B] ($[COLOR=teal]b[/COLOR]=[COLOR=blue]0[/COLOR];$[COLOR=teal]b[/COLOR]<$[COLOR=teal]keywordcount[/COLOR];$[COLOR=teal]b[/COLOR]++)
{
$[COLOR=teal]keywords[/COLOR][$[COLOR=teal]a[/COLOR]] = [COLOR=teal]explode[/COLOR]([COLOR=darkred] ";"[/COLOR], $[COLOR=teal]value[/COLOR][$[COLOR=teal]a[/COLOR]][[COLOR=blue]5[/COLOR]]);
}
$[COLOR=teal]keywordscount[/COLOR] = [COLOR=teal]count[/COLOR]($[COLOR=teal]keywords[/COLOR][$[COLOR=teal]a[/COLOR]]);
[B]for[/B] ($[COLOR=teal]c[/COLOR]=[COLOR=blue]0[/COLOR];$[COLOR=teal]c[/COLOR]<$[COLOR=teal]keywordscount[/COLOR];$[COLOR=teal]c[/COLOR]++)
{
$[COLOR=teal]userentry[/COLOR] = [COLOR=teal]explode[/COLOR]([COLOR=darkred] " "[/COLOR], $[COLOR=teal]searchwords[/COLOR]);
$[COLOR=teal]userentrycount[/COLOR] = [COLOR=teal]count[/COLOR]($[COLOR=teal]userentry[/COLOR]);
[B]for[/B]($[COLOR=teal]d[/COLOR]=[COLOR=blue]0[/COLOR];$[COLOR=teal]d[/COLOR]<$[COLOR=teal]userentrycount[/COLOR];$[COLOR=teal]d[/COLOR]++)
{
[B]if[/B] ([COLOR=teal]preg_match[/COLOR]([COLOR=darkred] "/\b$userentry[$d]\b/i"[/COLOR], $[COLOR=teal]keywords[/COLOR][$[COLOR=teal]a[/COLOR]][$[COLOR=teal]c[/COLOR]]))
// $keywords is the variable that becomes null, ironicly the most improtaint variable in the whole code.
$x++;
}
}
[B]if[/B] ($[COLOR=teal]p[/COLOR]>[COLOR=blue]1[/COLOR])
{
[B]print[/B] [COLOR=darkred] "</table><table width=100% border=0 cellspacing=0 cellpadding=0><tr><td width=200 background=html/images/sidebg.gif valign=top align=left rowspan=4> "[/COLOR];
$[COLOR=teal]p[/COLOR]=[COLOR=blue]0[/COLOR];
}
[B]if[/B] ($[COLOR=teal]x[/COLOR]>[COLOR=blue]0[/COLOR])
{
$[COLOR=teal]pattern[/COLOR][[COLOR=blue]0[/COLOR]] =[COLOR=darkred] "/%%invnum%%/"[/COLOR];
$[COLOR=teal]pattern[/COLOR][[COLOR=blue]1[/COLOR]] = [COLOR=darkred] "/%%category%%/"[/COLOR];
$[COLOR=teal]pattern[/COLOR][[COLOR=blue]2[/COLOR]] =[COLOR=darkred] "/%%name%%/"[/COLOR];
$[COLOR=teal]pattern[/COLOR][[COLOR=blue]3[/COLOR]] = [COLOR=darkred] "/%%description%%/"[/COLOR];
$[COLOR=teal]pattern[/COLOR][[COLOR=blue]4[/COLOR]] =[COLOR=darkred] "/%%price%%/"[/COLOR];
$[COLOR=teal]pattern[/COLOR][[COLOR=blue]5[/COLOR]] = [COLOR=darkred] "/%%keywords%%/"[/COLOR];
[COLOR=teal]ksort[/COLOR] ($[COLOR=teal]pattern[/COLOR]);
[COLOR=teal]ksort[/COLOR] ($[COLOR=teal]value[/COLOR]);
$[COLOR=teal]replacebody[/COLOR] = ([COLOR=teal]preg_replace[/COLOR]($[COLOR=teal]pattern[/COLOR], $[COLOR=teal]value[/COLOR][$[COLOR=teal]a[/COLOR]], $[COLOR=teal]body[/COLOR]));
[B]print[/B] $[COLOR=teal]replacebody[/COLOR];
$[COLOR=teal]p[/COLOR]++;
$[COLOR=teal]s[/COLOR]++;
}
[B]if[/B] ($[COLOR=teal]p[/COLOR]>[COLOR=blue]1[/COLOR])
{
[B]print[/B] [COLOR=darkred] "<td width=* valign=top align=left rowspan=4><p> </p></td>"[/COLOR];
}
}
if ($p>0)
{
print "<td width=* valign=top align=left rowspan=4><p> </p></td>";
}
$fopen = fopen($ffooter, "r");
$footer = fread($fopen, filesize/COLOR);
print $footer;
print "</html>";
?>[/FONT]
All I need is the answer to my problem, please do not critisize my code or tell me what I can do better. Thanx