Jump to content


Photo

works in recordset test but not in browser?


  • Please log in to reply
2 replies to this topic

#1 w4seem

w4seem
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 06 November 2005 - 08:53 PM

can someone help me please with this dilemma...

why is it that my recordset test function returns the correct data
but when i preview in browser i get nothing?

any suggestions please?

this is my code copied directly from dw results page

<?php require_once('Connections/test_connection.php'); ?>
<?php
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

$colname_Recordset1 = "-1";
if (isset($_POST['searchfield'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_POST['searchfield'] : addslashes($_POST['searchfield']);
}
mysql_select_db($database_test_connection, $test_connection);
$query_Recordset1 = sprintf("SELECT * FROM table_films WHERE col_genre LIKE '%%%s%%'", $colname_Recordset1);
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $test_connection) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?php do { ?>
<p><?php echo $row_Recordset1['col_title']; ?><?php echo $row_Recordset1['col_director']; ?><?php echo $row_Recordset1['col_genre']; ?></p>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?></body>
</html>
<?php
mysql_free_result($Recordset1);
?>


#2 morpheus.100

morpheus.100
  • Members
  • PipPipPip
  • Advanced Member
  • 145 posts

Posted 07 December 2005 - 10:39 AM

Sure you got the table names correct?

I would also condense these lines. LIMIT can be used in your initial query.

$query_Recordset1 = sprintf("SELECT * FROM table_films WHERE col_genre LIKE '%%%s%%'", $colname_Recordset1);
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

#3 w4seem

w4seem
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 09 December 2005 - 07:57 PM

i found the answer guys, you can tell im new, i inserted the wrong php code into the run tie value, once i fixed that it worked fine.

thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users