Jump to content

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

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.