PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
cannot use variable in Pager....

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Structures
View previous topic :: View next topic  
Author Message
blender50



Joined: 08 Aug 2006
Posts: 1

PostPosted: Tue Aug 08, 2006 12:38 am    Post subject: cannot use variable in Pager.... Reply with quote

I'm new to PEAR and am wondering how to get the following to work.

I want to pass a SQL query from a form to a datagrid page that uses paging. The behavior I'm seeing is that the query runs fine but as soon as I try to follow any of the subsequant page links that are generated I get one of the following errors (I've tried a few things and the error has changed)

"Query parameter must be a string" or "MDB2 Error: syntax error".

This line seems to be wanting only a string where I placed the '$query'... $test = $datagrid->bind($query, $options, MDB2);

Also, if I hard code the query like so
$test = $datagrid->bind("SELECT * FROM merchants", $options, MDB2);
everything works flawlessly.

the pager code I'm trying to use is from here http://www.go-pear.org/manual/en/package.structures.structures-datagrid.example-simple.php

<?php
include("global.inc.php");
pt_register('POST','query1');
require 'Structures/DataGrid.php';
echo "$query1 ";

//example taken from http://www.go-pear.org/manual/en/package.structures.structures-datagrid.example-simple.php
// 10 records per page
$datagrid =& new Structures_DataGrid(10);

// Setup your datasource
$options = array('dsn' => 'pgsql://mecdba:!dba@192.168.60.88/myecheck_tmp');
$test = $datagrid->bind($query1, $options, MDB2);
if (PEAR::isError($test)) {
echo $test->getMessage();
}

// Print the DataGrid with the default renderer (HTML Table)
$test = $datagrid->render();
if (PEAR::isError($test)) {
echo $test->getMessage();
}

// Print the HTML paging links
$test = $datagrid->render(DATAGRID_RENDER_PAGER);
if (PEAR::isError($test)) {
echo $test->getMessage();
}

?>


and these are the PEAR Modules I've got installed...


Archive_Tar 1.3.1 stable
Console_Getopt 1.2 stable
DB 1.7.6 stable
DB_Pager 0.7 stable
HTML_Common 1.2.2 stable
HTML_Table 1.7.2 stable
MDB2 2.2.0 stable
MDB2_Driver_pgsql 1.2.0 stable
Pager 2.4.2 stable
PEAR 1.4.9 stable
Structures_DataGrid 0.7.1 beta
Structures_DataGrid_DataSource_DBQuery 0.1.1 beta
Structures_DataGrid_DataSource_MDB2 0.1.0 beta
Structures_DataGrid_Renderer_CSV 0.1.1 beta
Structures_DataGrid_Renderer_HTMLTable 0.1.0 beta
Structures_DataGrid_Renderer_Pager 0.1.0 beta
Structures_DataGrid_Renderer_XML 0.1.0 beta
XML_RPC 1.4.5 stable
XML_Util 1.1.1 stable


I sure hope somebody can help me find a solution. The only other thing I can think to do at this point would be to have an intermediate page parse and edit the final page but that would be an ugly hack and I'm convinced that there must be a better and safer way to accomplish this.

Thanks in advance for your guidance....

Cheers
Steve
Back to top
View user's profile Send private message
alex



Joined: 13 Sep 2006
Posts: 72

PostPosted: Tue Sep 19, 2006 10:28 am    Post subject: Reply with quote

Hi !
What is your pt_register function ? Does it return a string ? Do a gettype($query) ; what is the result ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Structures All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software