worldcomingtoanend Posted October 5, 2009 Share Posted October 5, 2009 i am desigining a search engine which uses PHP and XML. i have come up with a long code and after a long day of testing i am beginning to realise that the problem might be with my two functions below. however i cant seem to figure out what exactly is wrong. if you can pick up some errors on my 2 functions below i will appreciate hearing from you. thank you and if u need more info please let me know. FUNCTION 1 function startElement($parser, $name, $attrs) { global $to; global $from; global $show; global $results; if (empty($_GET['start'])) { $start=1; } else { $start=$_GET['start']; } global $maxNum; global $tag; $tag = $name; if ($name == "RECORD") { global $hit; $hit = array("index" => "$attrs"); } if ($name == "SEARCHRESULTS") { global $hits; $hits = $attrs["HITS"]; echo '<tr><td colspan="5" height="10px"> </td></tr>'; echo '<tr><td></td><td colspan="3">'; if ($hits != 0) { if (($start+$maxNum-1) > $hits) { $end=$hits; } else { $end=$start+$maxNum-1; } print("<p>$show $start $to $end $from $hits $results.</p>"); } else { global $nothing_found; echo $nothing_found; } echo '</td><td></td></tr>'; echo '<tr><td colspan="5" height="10px"> </td></tr>'; echo '<tr><td></td><td height="1" class="line" colspan="3"></td><td></td></tr>'; echo '<tr><td colspan="5"> </td></tr>'; } } FUNCTION 2 function endElement($parser, $name) { global $imageArray; global $hit; if ($name == "RECORD") { $score = number_format(($hit["SCORE"] * 100), 1, '.', " "); print '<tr> <td> </td> <td align="left" valign="top">' .'['.$score.'%] </td>' . '<td>' //------ . '<a href="' . $hit["VISIBLEPATH"] . '">'; if (empty($hit["TITLE"])) { $path=$hit["VISIBLEPATH"]; ereg ("/(.*)/(.*)", $path, $regs); print $regs[2]; } else { print $hit["TITLE"]; } print '</a> (' . $hit["LASTCHANGED"] . ')</td>'; $contentType=strtoupper($hit["CONTENTTYPE"]); if (isset($imageArray[$contentType])) { //-----$content = '<img src="'.$imageArray[$contentType].'" alt="'.$contentType.'" />'; } else { $content = " "; } print '<td>'. $content.'</td><td></td></tr>' . '<tr> <td></td> <td colspan="3">' .$hit["SUMMARY"] . '</td><td></td></tr>'; print '<td></td><td colspan="3">'.substr($hit["VISIBLEPATH"], 0, 100) .'</td><td></td></tr>' . '<tr><td colspan="5"> </td></tr>' . '<tr><td></td><td height="1" class="line" colspan="3"></td><td></td></tr>' . '<tr><td colspan="5"> </td></tr>'; } } Quote Link to comment https://forums.phpfreaks.com/topic/176567-solved-whats-wrong-with-my-two-functions/ Share on other sites More sharing options...
RussellReal Posted October 5, 2009 Share Posted October 5, 2009 show us the errors you receive Quote Link to comment https://forums.phpfreaks.com/topic/176567-solved-whats-wrong-with-my-two-functions/#findComment-930864 Share on other sites More sharing options...
worldcomingtoanend Posted October 5, 2009 Author Share Posted October 5, 2009 show us the errors you receive my server does show errors but on this one it just goes blank and no error is displayed. usually when that happens its a sign that the error is somehow very fatal. The moment i remove those 2 functions everything seems to run very well but i cant do a search engine without those 2 fucntions. Unless if you want me to display my complete very long code Quote Link to comment https://forums.phpfreaks.com/topic/176567-solved-whats-wrong-with-my-two-functions/#findComment-930886 Share on other sites More sharing options...
cags Posted October 5, 2009 Share Posted October 5, 2009 What are the error_reporting settings on your server? Quote Link to comment https://forums.phpfreaks.com/topic/176567-solved-whats-wrong-with-my-two-functions/#findComment-930889 Share on other sites More sharing options...
worldcomingtoanend Posted October 5, 2009 Author Share Posted October 5, 2009 What are the error_reporting settings on your server? well for now i cant check the server settings because of my location. but is there anything wrong with my functions Quote Link to comment https://forums.phpfreaks.com/topic/176567-solved-whats-wrong-with-my-two-functions/#findComment-930898 Share on other sites More sharing options...
worldcomingtoanend Posted October 6, 2009 Author Share Posted October 6, 2009 Okay i have double checked my errors and i am getting the dreaded parse error like this: "parse error in X:\Programme\sasasas0\www\asaas.php on line 432" Quote Link to comment https://forums.phpfreaks.com/topic/176567-solved-whats-wrong-with-my-two-functions/#findComment-931354 Share on other sites More sharing options...
kickstart Posted October 6, 2009 Share Posted October 6, 2009 Hi Not sure if it is just something caused when pasting here, but the 2nd script is missing a ; (at the end of the first print statement). However I would expect that to flag up an obvious error. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/176567-solved-whats-wrong-with-my-two-functions/#findComment-931357 Share on other sites More sharing options...
worldcomingtoanend Posted October 6, 2009 Author Share Posted October 6, 2009 Hi Not sure if it is just something caused when pasting here, but the 2nd script is missing a ; (at the end of the first print statement). However I would expect that to flag up an obvious error. All the best Keith Yes yes yes yes Keith that was the problem..the moment i put the ; everything went rolling. thanks for brightening my day. all the best. Quote Link to comment https://forums.phpfreaks.com/topic/176567-solved-whats-wrong-with-my-two-functions/#findComment-931358 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.