w4seem Posted November 6, 2005 Share Posted November 6, 2005 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); ?> Quote Link to comment https://forums.phpfreaks.com/topic/2817-works-in-recordset-test-but-not-in-browser/ Share on other sites More sharing options...
morpheus.100 Posted December 7, 2005 Share Posted December 7, 2005 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); Quote Link to comment https://forums.phpfreaks.com/topic/2817-works-in-recordset-test-but-not-in-browser/#findComment-10055 Share on other sites More sharing options...
w4seem Posted December 9, 2005 Author Share Posted December 9, 2005 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 Quote Link to comment https://forums.phpfreaks.com/topic/2817-works-in-recordset-test-but-not-in-browser/#findComment-10101 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.