Jump to content

works in recordset test but not in browser?


Recommended Posts

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/xhtml1/DTD/xhtml1-transitional.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);

?>

 

  • 1 month later...

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);

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.