PDA

View Full Version : Invalid variables in recordset


johnlanglois
07-07-2009, 09:41 PM
I had hoped that this might be the product that breaks my three-year long cycle of WA products that never work straight out of the gate. Alas, they are using us as beta testers again.

This product is much worse in terms of poor documentation and examples for a real world setting, such as a separate testing server, than previous products.

The index.php file in cms100\admin\index.php reports that content is an invalid variable because it's not used in the SQL and that content_id has no run time value.

Should I just ignore these warnings?

Ray Borduin
07-08-2009, 07:29 AM
When and where do you get those warnings? I don't think they should be ignored. Please explain more fully so I can understand what you are talking about.

johnlanglois
07-08-2009, 11:47 AM
When and where do you get those warnings? I don't think they should be ignored. Please explain more fully so I can understand what you are talking about.

Sure. Here's the code from index.php under admin that is causing the error.



<?php
// RepeatSelectionCounter_2 Begin Loop
$RepeatSelectionCounter_2_IterationsRemaining = $RepeatSelectionCounter_2_Iterations;
while($RepeatSelectionCounter_2_IterationsRemainin g--){
if($RepeatSelectionCounterBasedLooping_2 || $row_contenthistory){
?>
<div id="leftPod<?php echo $RepeatSelectionCounter_2; ?>" class="leftPod">
Date: <?php echo date("m/d/Y", $row_contenthistory['HistoryDate']); ?><br />
Page: <?php echo $row_contenthistory['HistoryGroup']; ?><br />
Area: <?php echo $row_contenthistory['HistoryReference']; ?><br />
<?php
$content_id_Actions = "-1";
if (isset($content_id)) {
$content_id_Actions = (get_magic_quotes_gpc()) ? $content_id : addslashes($content_id);
}
mysql_select_db($database_TestingServer, $TestingServer);
$query_Actions = sprintf("SELECT * FROM contenthistory WHERE contenthistory.HistoryContentID = %s", GetSQLValueString($content_id_Actions, "int"));
$Actions = mysql_query($query_Actions, $TestingServer) or die(mysql_error());
$row_Actions = mysql_fetch_assoc($Actions);
$totalRows_Actions = mysql_num_rows($Actions);

mysql_select_db($database_localhost, $localhost);
$query_ContentActions = sprintf("SELECT * FROM contents WHERE contents.ContentID = %s", GetSQLValueString($row_contenthistory['HistoryContentID'], "int"));
$ContentActions = mysql_query($query_ContentActions, $localhost) or die(mysql_error());
$row_ContentActions = mysql_fetch_assoc($ContentActions);
$totalRows_ContentActions = mysql_num_rows($ContentActions);
?>
Action: <?php if($totalRows_Actions > 1 && $totalRows_ContentActions > 0 ) { ?>Updated
<?php } else if ($totalRows_ContentActions == 0) { ?>Deleted
<?php } else { ?>Inserted<?php } ?><br />
<?php if ($totalRows_ContentActions > 0) { ?>
<span style="margin-left:95px;">
<a href="contents_detail.php?ContentID=<?php echo $row_contenthistory['HistoryContentID']; ?>" style="color:#004899;" title="View">View Content</a>
</span>
<?php } else { ?><span style="display:block; height:15px;"></span><?php } ?>
</div>
<?php
} // RepeatSelectionCounter_2 Begin Alternate Content
else{
?>
<?php } // RepeatSelectionCounter_2 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_2 && $RepeatSelectionCounter_2_IterationsRemaining != 0){
if(!$row_contenthistory && $RepeatSelectionCounter_2_Iterations == -1){$RepeatSelectionCounter_2_IterationsRemaining = 0;}
$row_contenthistory = mysql_fetch_assoc($contenthistory);
}
$RepeatSelectionCounter_2++;
} // RepeatSelectionCounter_2 End Loop
?>

Ray Borduin
07-08-2009, 11:50 AM
Does it give an error line number?

johnlanglois
07-08-2009, 11:55 AM
Does it give an error line number?

Assuming the page didn't change things much from the original, you should find the offending code in lines 193-207.

Thanks.

Ray Borduin
07-08-2009, 12:01 PM
Please post a support incident including the entire file and the full error message. I can't seem to spot the problem but I would be interested in researching it more.

johnlanglois
07-09-2009, 09:22 AM
Please post a support incident including the entire file and the full error message. I can't seem to spot the problem but I would be interested in researching it more.

I have submitted a ticket, along with all the files in a zipped folder.

Initially, the problem seems to be set in motion because the record sets have lost the definition of their connections. Redefining the connection resolved the first two queries, but left others with undefined variables. Dreamweaver won't restore the connection until the undefined variables are addressed and I don't know what their run-time values were supposed to be.

It almost seems like the product is hard-wired to be in one and only one folder, which would be a really short-sighted way to write the code because of issues like testing server verses production server.