ready2drum Posted August 17, 2009 Share Posted August 17, 2009 I'm trying to fix an error that references some piece of code that someone else setup a while ago and they're no longer around to ask/discuss it with. The error message references the following code, Line 62: <?php $Q = new COM("ixsso.Query"); $util = new COM("ixsso.util"); $Q->Catalog = "E:\GROUP\BigWeb\jha"; /*Line 62*/ $Q->Query = $_POST['query']; $Q->Columns = "filename, rank, vpath, path, DocTitle, characterization, All"; $Q->SortBy = "rank[d]"; $Q->MaxRecords = 200; $fileRS = $Q->CreateRecordSet("nonsequential"); if(!$fileRS->RecordCount == 0) { $fileRS->MoveFirst(); } while($i < $fileRS->RecordCount) { ?> The error message that shows up on screen is as follows: Notice: Undefined index: query in E:\Inetpub\wwwroot\Intranet_Old\intranet\jha\jha_doc_results.php on line 62 Fatal error: Uncaught exception 'com_exception' with message 'Parameter 0: Type mismatch. ' in E:\Inetpub\wwwroot\Intranet_Old\intranet\jha\jha_doc_results.php:62 Stack trace: #0 E:\Inetpub\wwwroot\Intranet_Old\intranet\jha\jha_doc_results.php(62): unknown() #1 {main} thrown in E:\Inetpub\wwwroot\Intranet_Old\intranet\jha\jha_doc_results.php on line 62 The code mentioned at the beginning pertains to a 'Search' feature that allows users the ability to type in a string and have the results displayed on the screen, however, everytime I enter a word or words in the text box and then click on the 'Search' button, the error message appears. Line 61 of the code: $Q->Catalog = "E:\GROUP\BigWeb\jha"; //there are multiple catalog.wci folders located on the shared GROUP directory and also under the BigWeb directory. In addition, from the research I've done so far, the built-in $_POST function is used to collect values in a form with method="post", and since there are no lines referencing 'method="post" anywhere in the code, it confirms that the way it's written on Line 62, is not valid. I hope this makes sense to someone out there on the forum because I'm trying to explain it the best way I know how....so if anyone has ANY suggestions on what to do to resolve this, I'd greatly appreciate it. Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/170645-need-help-resolving-an-error-undefined-index-query-in/ Share on other sites More sharing options...
infiniteacuity Posted August 17, 2009 Share Posted August 17, 2009 You should echo $_POST['query'] to see what is being passed. My guess is nothing since you said the form does not have method = post. Try adding that it might just fix your problem. Link to comment https://forums.phpfreaks.com/topic/170645-need-help-resolving-an-error-undefined-index-query-in/#findComment-900203 Share on other sites More sharing options...
ready2drum Posted August 17, 2009 Author Share Posted August 17, 2009 I appreciate your help with this issue...I also noticed some missing braces '}' ...here's the full code within the php tags... ________ <?php $Q = new COM("ixsso.Query"); $util = new COM("ixsso.util"); $Q->Catalog = "E:\GROUP\BigWeb\jha"; $Q->Query = $_POST['query']; $Q->Columns = "filename, rank, vpath, path, DocTitle, characterization, All"; $Q->SortBy = "rank[d]"; $Q->MaxRecords = 200; $fileRS = $Q->CreateRecordSet("nonsequential"); if(!$fileRS->RecordCount == 0) { $fileRS->MoveFirst(); } while($i < $fileRS->RecordCount) { ?> <div id="search_results"> <table width="100%" border="0" cellpadding="0"> <tr> <td height="20" class="fstyle_4"><?php echo($fileRS->fields['DocTitle']->value); ?></td> </tr> <tr> <td class="fstyle_5"><a href="<?php echo($fileRS->fields['path']->value); ?>"><?php echo($fileRS->fields['filename']->value); ?></a></td> </tr> <tr> <td class="fstyle_5"><?php echo($fileRS->fields['characterization']->value); ?></td> </tr> <tr> <td class="fstyle_5"><hr /></td> </tr> </table> </div> <?php $fileRS->MoveNext(); $i++; } ?> __________ shouldn't there be a closing brace '}' for line 70? while($i < $fileRS->RecordCount) { ?> ...and also for an opening brace for line 89? $fileRS->MoveNext(); $i++; } _________ just curious if the missing braces had any bearing on the error message...what do you think? Link to comment https://forums.phpfreaks.com/topic/170645-need-help-resolving-an-error-undefined-index-query-in/#findComment-900255 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.