Jump to content

Need help resolving an error: "Undefined Index: query in..."


ready2drum

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.