By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,750 Members | 1,471 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,750 IT Pros & Developers. It's quick & easy.

Help with browsing db

P: n/a
Need some opinions on how best to display in excess of 14K records
based on users search criteria.

Application Concept:
-----------------------

[1] User enters various search criteria (as many as 13 different
fields) AND can select 2 fields to sort on.
[2] User can also limit the results displayed per page
[3] Once the user presses "Submit", the SQL string is built and the DB
is queried.
[4] Results are displayed to the user, x records per page with "Next
<<->> Previous" link under results. If user
did not choose a limit, I limit to 20 records per page.
[5] Clicking on the Next or Previous links walks the user through the
data.
Application Logic
-----------------------

[PHP]

if($submit) {
// Code to display results etc
} else {
// Code to gather search criteria
}

[/PHP]

Sounds simple, right? Basically it is, however I am attempting to do
something here I have never done before. In other
applications I have developed, I have only used the Next - Previous
link idea when I have simply pulled the entire database
so that the user could browse the db. This time though I need to allow
the user to set parameters before browsing.

Here's my problem from a code perspective:

[PHP]
<?
if($start OR $submit) {
if(!isset($start)) $start = 0;

// First step, let's connect to the DB and then build the SQL
string

$db = mysql_connect("host", "user", "password") or die("Could
not connect to db: ". mysql_error());
mysql_select_db("dbname",$db);

// Our various search terms from from the initial form. Let's
build the SQL string we are going to use

// First, change the cost figures to something SQL will
recognize.

$val1=dollarval($dolval=$AYVAL);$val2=dollarval($d olval=$BYVAL);
$val3=dollarval($dolval=$EYVAL);$val4=dollarval($d olval=$Y4VAL);

// Set up to use wildcards by default if the user chooses
nothing for the field
if(!$fsc) $fsc='%';if(!$niin) $niin='%';if(!$mmac)
$mmac='%';if(!$ims) $ims='%';if(!$smc) $smc='%';
if(!$PMS_BUYER) $PMS_BUYER='%';if(!$PMS_SELLER)
$PMS_SELLER='%';
$sql="SELECT * FROM Repair WHERE ALC LIKE '%' AND BP LIKE
'$bpc' AND FSC LIKE '$fsc' AND NIIN LIKE '$niin'
AND SGM_MMAC LIKE '$mmac' AND IMS LIKE '$ims' AND SMC LIKE
'$smc' AND PMS_BUYER LIKE '$PMS_BUYER' AND
PMS_SELLER LIKE '$PMS_SELLER' AND AY_VAL_ACT_ROLLUP $val1 AND
BY_VAL_ACT_ROLLUP $val2 AND EY_VAL_ACT_ROLLUP
$val3 AND Y4_VAL_ACT_ROLLUP $val4 ORDER BY $orderby1,$orderby2
LIMIT $start, 20";
$result=mysql_query($sql,$db);

// get the count of the number of rows of data
$query = "SELECT count(*) as count FROM Repair";
$res = mysql_query($query);
$row = mysql_fetch_array($res);
$numrows = $row['count'];

$result = mysql_query($sql);

echo $sql;
echo "<CENTER>There are " . $numrows . " records</CENTER>";

// Now, switch to HTML for easier coding
?>
<TABLE BORDER=2 CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER>
<COL><COL><COL><COL><COL>
<TBODY>
<TR>
<TD>ALC</TD>
<TD>FSC</TD>
<TD>NIIN</TD>
<TD>MMAC</TD>
<TD>Noun</TD>
<TD>First Year Qty</TD>
<TD>Options</TD>
</TR>
<?
while($myrow=mysql_fetch_array($result)) {
echo "<TR>";
echo "<TD
CLASS=data>".$myrow["ALC"]."</TD>";
echo "<TD
CLASS=data>".$myrow["FSC"]."</TD>";
echo "<TD
CLASS=data>".$myrow["NIIN"]."</TD>";
echo "<TD
CLASS=data>".$myrow["SGM_MMAC"]."</TD>";
echo "<TD
CLASS=data>".$myrow["NOUN"]."</TD>";
echo "<TD
CLASS=data>".$myrow["AY_QTY_ACT_ROLLUP"]."</TD>";
echo "<TD CLASS=data><a TARGET=_BLANK
href=viewrep.php?id=".$myrow["ID"].">View</a></TD>";
echo "</TR>";
}
?>
</TBODY>
</TABLE>
<?
if($start > 0)
echo "<CENTER><A HREF=\"" . $PHP_SELF . "?start=" .
($start - 20) . "\">Previous</A></CENTER><BR>\n";
if($numrows > ($start + 20))
echo "<CENTER><A HREF=\"" . $PHP_SELF . "?start=" .
($start + 20) . "\">Next</A></CENTER><BR>\n";

} else {

?>
User input code here
<TR><TD COLSPAN=5 ALIGN=center><INPUT TYPE="submit"
NAME="submit" VALUE="Find Data"></TD></TR>
</TBODY>
</TABLE>

[/PHP]

My problem appears to be that my variables are not carrying over
whenever Next or Previous is clicked. Anybody have a suggestion as to
how I can get this to work?

TIA

rk

Jul 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Hi,

redneck_kiwi wrote:

Need some opinions on how best to display in excess of 14K records
based on users search criteria.

Application Concept:
-----------------------

[1] User enters various search criteria (as many as 13 different
fields) AND can select 2 fields to sort on.
[2] User can also limit the results displayed per page
[3] Once the user presses "Submit", the SQL string is built and the DB
is queried.
[4] Results are displayed to the user, x records per page with "Next
<<->> Previous" link under results. If user
did not choose a limit, I limit to 20 records per page.
[5] Clicking on the Next or Previous links walks the user through the
data.

Application Logic
-----------------------

[PHP]

if($submit) {
// Code to display results etc
} else {
// Code to gather search criteria
}

[/PHP]

Sounds simple, right? Basically it is, however I am attempting to do
something here I have never done before. In other
applications I have developed, I have only used the Next - Previous
link idea when I have simply pulled the entire database
so that the user could browse the db. This time though I need to allow
the user to set parameters before browsing.

Here's my problem from a code perspective:

[PHP]
<?
if($start OR $submit) {
if(!isset($start)) $start = 0;

// First step, let's connect to the DB and then build the SQL
string

$db = mysql_connect("host", "user", "password") or die("Could
not connect to db: ". mysql_error());
mysql_select_db("dbname",$db);

// Our various search terms from from the initial form. Let's
build the SQL string we are going to use

// First, change the cost figures to something SQL will
recognize.

$val1=dollarval($dolval=$AYVAL);$val2=dollarval($d olval=$BYVAL);
$val3=dollarval($dolval=$EYVAL);$val4=dollarval($d olval=$Y4VAL);

// Set up to use wildcards by default if the user chooses
nothing for the field
if(!$fsc) $fsc='%';if(!$niin) $niin='%';if(!$mmac)
$mmac='%';if(!$ims) $ims='%';if(!$smc) $smc='%';
if(!$PMS_BUYER) $PMS_BUYER='%';if(!$PMS_SELLER)
$PMS_SELLER='%';

$sql="SELECT * FROM Repair WHERE ALC LIKE '%' AND BP LIKE
'$bpc' AND FSC LIKE '$fsc' AND NIIN LIKE '$niin'
AND SGM_MMAC LIKE '$mmac' AND IMS LIKE '$ims' AND SMC LIKE
'$smc' AND PMS_BUYER LIKE '$PMS_BUYER' AND
PMS_SELLER LIKE '$PMS_SELLER' AND AY_VAL_ACT_ROLLUP $val1 AND
BY_VAL_ACT_ROLLUP $val2 AND EY_VAL_ACT_ROLLUP
$val3 AND Y4_VAL_ACT_ROLLUP $val4 ORDER BY $orderby1,$orderby2
LIMIT $start, 20";
$result=mysql_query($sql,$db);

// get the count of the number of rows of data
$query = "SELECT count(*) as count FROM Repair";
$res = mysql_query($query);
$row = mysql_fetch_array($res);
$numrows = $row['count'];

$result = mysql_query($sql);

echo $sql;
echo "<CENTER>There are " . $numrows . " records</CENTER>";

// Now, switch to HTML for easier coding
?>
<TABLE BORDER=2 CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER>
<COL><COL><COL><COL><COL>
<TBODY>
<TR>
<TD>ALC</TD>
<TD>FSC</TD>
<TD>NIIN</TD>
<TD>MMAC</TD>
<TD>Noun</TD>
<TD>First Year Qty</TD>
<TD>Options</TD>
</TR>
<?
while($myrow=mysql_fetch_array($result)) {
echo "<TR>";
echo "<TD
CLASS=data>".$myrow["ALC"]."</TD>";
echo "<TD
CLASS=data>".$myrow["FSC"]."</TD>";
echo "<TD
CLASS=data>".$myrow["NIIN"]."</TD>";
echo "<TD
CLASS=data>".$myrow["SGM_MMAC"]."</TD>";
echo "<TD
CLASS=data>".$myrow["NOUN"]."</TD>";
echo "<TD
CLASS=data>".$myrow["AY_QTY_ACT_ROLLUP"]."</TD>";
echo "<TD CLASS=data><a TARGET=_BLANK
href=viewrep.php?id=".$myrow["ID"].">View</a></TD>";
echo "</TR>";
}
?>
</TBODY>
</TABLE>
<?
if($start > 0)
echo "<CENTER><A HREF=\"" . $PHP_SELF . "?start=" .
($start - 20) . "\">Previous</A></CENTER><BR>\n";
if($numrows > ($start + 20))
echo "<CENTER><A HREF=\"" . $PHP_SELF . "?start=" .
($start + 20) . "\">Next</A></CENTER><BR>\n";

} else {

?>
User input code here
<TR><TD COLSPAN=5 ALIGN=center><INPUT TYPE="submit"
NAME="submit" VALUE="Find Data"></TD></TR>
</TBODY>
</TABLE>

[/PHP]

My problem appears to be that my variables are not carrying over
whenever Next or Previous is clicked. Anybody have a suggestion as to
how I can get this to work?


Hi,
I didn't actually read through all your code, but you should probably validate,
then set the validated variables as session variables. Then you can just use
the session variables as-is on any subsequent page and use them to build your
query.

Shawn

--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #2

P: n/a
Hi,

redneck_kiwi wrote:

Need some opinions on how best to display in excess of 14K records
based on users search criteria.

Application Concept:
-----------------------

[1] User enters various search criteria (as many as 13 different
fields) AND can select 2 fields to sort on.
[2] User can also limit the results displayed per page
[3] Once the user presses "Submit", the SQL string is built and the DB
is queried.
[4] Results are displayed to the user, x records per page with "Next
<<->> Previous" link under results. If user
did not choose a limit, I limit to 20 records per page.
[5] Clicking on the Next or Previous links walks the user through the
data.

Application Logic
-----------------------

[PHP]

if($submit) {
// Code to display results etc
} else {
// Code to gather search criteria
}

[/PHP]

Sounds simple, right? Basically it is, however I am attempting to do
something here I have never done before. In other
applications I have developed, I have only used the Next - Previous
link idea when I have simply pulled the entire database
so that the user could browse the db. This time though I need to allow
the user to set parameters before browsing.

Here's my problem from a code perspective:

[PHP]
<?
if($start OR $submit) {
if(!isset($start)) $start = 0;

// First step, let's connect to the DB and then build the SQL
string

$db = mysql_connect("host", "user", "password") or die("Could
not connect to db: ". mysql_error());
mysql_select_db("dbname",$db);

// Our various search terms from from the initial form. Let's
build the SQL string we are going to use

// First, change the cost figures to something SQL will
recognize.

$val1=dollarval($dolval=$AYVAL);$val2=dollarval($d olval=$BYVAL);
$val3=dollarval($dolval=$EYVAL);$val4=dollarval($d olval=$Y4VAL);

// Set up to use wildcards by default if the user chooses
nothing for the field
if(!$fsc) $fsc='%';if(!$niin) $niin='%';if(!$mmac)
$mmac='%';if(!$ims) $ims='%';if(!$smc) $smc='%';
if(!$PMS_BUYER) $PMS_BUYER='%';if(!$PMS_SELLER)
$PMS_SELLER='%';

$sql="SELECT * FROM Repair WHERE ALC LIKE '%' AND BP LIKE
'$bpc' AND FSC LIKE '$fsc' AND NIIN LIKE '$niin'
AND SGM_MMAC LIKE '$mmac' AND IMS LIKE '$ims' AND SMC LIKE
'$smc' AND PMS_BUYER LIKE '$PMS_BUYER' AND
PMS_SELLER LIKE '$PMS_SELLER' AND AY_VAL_ACT_ROLLUP $val1 AND
BY_VAL_ACT_ROLLUP $val2 AND EY_VAL_ACT_ROLLUP
$val3 AND Y4_VAL_ACT_ROLLUP $val4 ORDER BY $orderby1,$orderby2
LIMIT $start, 20";
$result=mysql_query($sql,$db);

// get the count of the number of rows of data
$query = "SELECT count(*) as count FROM Repair";
$res = mysql_query($query);
$row = mysql_fetch_array($res);
$numrows = $row['count'];

$result = mysql_query($sql);

echo $sql;
echo "<CENTER>There are " . $numrows . " records</CENTER>";

// Now, switch to HTML for easier coding
?>
<TABLE BORDER=2 CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER>
<COL><COL><COL><COL><COL>
<TBODY>
<TR>
<TD>ALC</TD>
<TD>FSC</TD>
<TD>NIIN</TD>
<TD>MMAC</TD>
<TD>Noun</TD>
<TD>First Year Qty</TD>
<TD>Options</TD>
</TR>
<?
while($myrow=mysql_fetch_array($result)) {
echo "<TR>";
echo "<TD
CLASS=data>".$myrow["ALC"]."</TD>";
echo "<TD
CLASS=data>".$myrow["FSC"]."</TD>";
echo "<TD
CLASS=data>".$myrow["NIIN"]."</TD>";
echo "<TD
CLASS=data>".$myrow["SGM_MMAC"]."</TD>";
echo "<TD
CLASS=data>".$myrow["NOUN"]."</TD>";
echo "<TD
CLASS=data>".$myrow["AY_QTY_ACT_ROLLUP"]."</TD>";
echo "<TD CLASS=data><a TARGET=_BLANK
href=viewrep.php?id=".$myrow["ID"].">View</a></TD>";
echo "</TR>";
}
?>
</TBODY>
</TABLE>
<?
if($start > 0)
echo "<CENTER><A HREF=\"" . $PHP_SELF . "?start=" .
($start - 20) . "\">Previous</A></CENTER><BR>\n";
if($numrows > ($start + 20))
echo "<CENTER><A HREF=\"" . $PHP_SELF . "?start=" .
($start + 20) . "\">Next</A></CENTER><BR>\n";

} else {

?>
User input code here
<TR><TD COLSPAN=5 ALIGN=center><INPUT TYPE="submit"
NAME="submit" VALUE="Find Data"></TD></TR>
</TBODY>
</TABLE>

[/PHP]

My problem appears to be that my variables are not carrying over
whenever Next or Previous is clicked. Anybody have a suggestion as to
how I can get this to work?


Hi,
I didn't actually read through all your code, but you should probably validate,
then set the validated variables as session variables. Then you can just use
the session variables as-is on any subsequent page and use them to build your
query.

Shawn

--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #3

P: n/a
I took your suggestion to use session variables and it "almost"
works....

$_SESSION["sqlqry"]="SELECT * FROM Repair WHERE ALC LIKE '%' AND BP
LIKE '$bpc' AND FSC LIKE '$fsc' AND NIIN LIKE '$niin' AND SGM_MMAC LIKE
'$mmac' AND IMS LIKE '$ims' AND SMC LIKE '$smc' AND PMS_BUYER LIKE
'$PMS_BUYER' AND PMS_SELLER LIKE '$PMS_SELLER' AND Y_VAL_ACT_ROLLUP
$val1 AND BY_VAL_ACT_ROLLUP $val2 AND EY_VAL_ACT_ROLLUP
$val3 AND Y4_VAL_ACT_ROLLUP $val4 ORDER BY '$orderby1','$orderby2'
LIMIT"

For whatever reason, the '$orderby1' and '$orderby2' variables are not
carrying through. What am I doing wrong?

Jul 17 '05 #4

P: n/a
redneck_kiwi wrote:
I took your suggestion to use session variables and it "almost"
works....
[reformatted]

$_SESSION["sqlqry"] = "
SELECT *

FROM Repair

WHERE ALC LIKE '%'
AND BP LIKE '$bpc'
AND FSC LIKE '$fsc'
AND NIIN LIKE '$niin'
AND SGM_MMAC LIKE '$mmac'
AND IMS LIKE '$ims'
AND SMC LIKE '$smc'
AND PMS_BUYER LIKE '$PMS_BUYER'
AND PMS_SELLER LIKE '$PMS_SELLER'
AND Y_VAL_ACT_ROLLUP $val1 <== isn't there
AND BY_VAL_ACT_ROLLUP $val2 <== something
AND EY_VAL_ACT_ROLLUP $val3 <== missing
AND Y4_VAL_ACT_ROLLUP $val4 <== around here?

ORDER BY '$orderby1','$orderby2'

LIMIT <== and here?
"
For whatever reason, the '$orderby1' and '$orderby2' variables are not
carrying through. What am I doing wrong?


1. try verifying the contents your session array:

<?php
echo '<pre>$_SESSION array:<br>';
print_r($_SESSION);
echo '<br></pre>';
?>

2. And I'd not use globals, nor copy the session to 'normal' variables;
but instead I'd use the session array directly to build the query:

<?php
/* AFAICT there's no need to put the query in the session array */
$sqlqry = <<<SQL_QUERY
SELECT column1, col2, col18, col7, ...

FROM Repair

WHERE ALC LIKE '%'
AND BP LIKE '$_SESSION[bpc]'
AND ...

...

ORDER BY '$_SESSION[orderby1]', '$_SESSION[orderby2]'

LIMIT ...
SQL_QUERY;
?>

3. Also try to see if you're using undeclared variables, by putting

<?php error_reporting(E_ALL); ?>

at the very top of your scripts.

Happy Coding :-)
--
USENET would be a better place if everybody read:
http://www.expita.com/nomime.html
http://www.netmeister.org/news/learn2quote2.html
http://www.catb.org/~esr/faqs/smart-questions.html
Jul 17 '05 #5

P: n/a
If you want help with pagination take a look at
http://www.tonymarston.co.uk/php-mysql/pagination.html

--
Tony Marston

http://www.tonymarston.net

"redneck_kiwi" <kf****@gmail.com> wrote in message
news:10**********************@f14g2000cwb.googlegr oups.com...
Need some opinions on how best to display in excess of 14K records
based on users search criteria.

Application Concept:
-----------------------

[1] User enters various search criteria (as many as 13 different
fields) AND can select 2 fields to sort on.
[2] User can also limit the results displayed per page
[3] Once the user presses "Submit", the SQL string is built and the DB
is queried.
[4] Results are displayed to the user, x records per page with "Next
<<->> Previous" link under results. If user
did not choose a limit, I limit to 20 records per page.
[5] Clicking on the Next or Previous links walks the user through the
data.
Application Logic
-----------------------

[PHP]

if($submit) {
// Code to display results etc
} else {
// Code to gather search criteria
}

[/PHP]

Sounds simple, right? Basically it is, however I am attempting to do
something here I have never done before. In other
applications I have developed, I have only used the Next - Previous
link idea when I have simply pulled the entire database
so that the user could browse the db. This time though I need to allow
the user to set parameters before browsing.

Here's my problem from a code perspective:

[PHP]
<?
if($start OR $submit) {
if(!isset($start)) $start = 0;

// First step, let's connect to the DB and then build the SQL
string

$db = mysql_connect("host", "user", "password") or die("Could
not connect to db: ". mysql_error());
mysql_select_db("dbname",$db);

// Our various search terms from from the initial form. Let's
build the SQL string we are going to use

// First, change the cost figures to something SQL will
recognize.

$val1=dollarval($dolval=$AYVAL);$val2=dollarval($d olval=$BYVAL);
$val3=dollarval($dolval=$EYVAL);$val4=dollarval($d olval=$Y4VAL);

// Set up to use wildcards by default if the user chooses
nothing for the field
if(!$fsc) $fsc='%';if(!$niin) $niin='%';if(!$mmac)
$mmac='%';if(!$ims) $ims='%';if(!$smc) $smc='%';
if(!$PMS_BUYER) $PMS_BUYER='%';if(!$PMS_SELLER)
$PMS_SELLER='%';
$sql="SELECT * FROM Repair WHERE ALC LIKE '%' AND BP LIKE
'$bpc' AND FSC LIKE '$fsc' AND NIIN LIKE '$niin'
AND SGM_MMAC LIKE '$mmac' AND IMS LIKE '$ims' AND SMC LIKE
'$smc' AND PMS_BUYER LIKE '$PMS_BUYER' AND
PMS_SELLER LIKE '$PMS_SELLER' AND AY_VAL_ACT_ROLLUP $val1 AND
BY_VAL_ACT_ROLLUP $val2 AND EY_VAL_ACT_ROLLUP
$val3 AND Y4_VAL_ACT_ROLLUP $val4 ORDER BY $orderby1,$orderby2
LIMIT $start, 20";
$result=mysql_query($sql,$db);

// get the count of the number of rows of data
$query = "SELECT count(*) as count FROM Repair";
$res = mysql_query($query);
$row = mysql_fetch_array($res);
$numrows = $row['count'];

$result = mysql_query($sql);

echo $sql;
echo "<CENTER>There are " . $numrows . " records</CENTER>";

// Now, switch to HTML for easier coding
?>
<TABLE BORDER=2 CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER>
<COL><COL><COL><COL><COL>
<TBODY>
<TR>
<TD>ALC</TD>
<TD>FSC</TD>
<TD>NIIN</TD>
<TD>MMAC</TD>
<TD>Noun</TD>
<TD>First Year Qty</TD>
<TD>Options</TD>
</TR>
<?
while($myrow=mysql_fetch_array($result)) {
echo "<TR>";
echo "<TD
CLASS=data>".$myrow["ALC"]."</TD>";
echo "<TD
CLASS=data>".$myrow["FSC"]."</TD>";
echo "<TD
CLASS=data>".$myrow["NIIN"]."</TD>";
echo "<TD
CLASS=data>".$myrow["SGM_MMAC"]."</TD>";
echo "<TD
CLASS=data>".$myrow["NOUN"]."</TD>";
echo "<TD
CLASS=data>".$myrow["AY_QTY_ACT_ROLLUP"]."</TD>";
echo "<TD CLASS=data><a TARGET=_BLANK
href=viewrep.php?id=".$myrow["ID"].">View</a></TD>";
echo "</TR>";
}
?>
</TBODY>
</TABLE>
<?
if($start > 0)
echo "<CENTER><A HREF=\"" . $PHP_SELF . "?start=" .
($start - 20) . "\">Previous</A></CENTER><BR>\n";
if($numrows > ($start + 20))
echo "<CENTER><A HREF=\"" . $PHP_SELF . "?start=" .
($start + 20) . "\">Next</A></CENTER><BR>\n";

} else {

?>
User input code here
<TR><TD COLSPAN=5 ALIGN=center><INPUT TYPE="submit"
NAME="submit" VALUE="Find Data"></TD></TR>
</TBODY>
</TABLE>

[/PHP]

My problem appears to be that my variables are not carrying over
whenever Next or Previous is clicked. Anybody have a suggestion as to
how I can get this to work?

TIA

rk

Jul 17 '05 #6

P: n/a
Taking some of your suggestions I get the following results:

[1] Verifying the contents of the session array:

First pass:
$_SESSION array: Array
(
[sqlqry] => SELECT * FROM Repair WHERE ALC LIKE '%' AND BP LIKE
'15' AND FSC LIKE '%' AND NIIN LIKE '%'
AND SGM_MMAC LIKE '%' AND IMS LIKE '%' AND SMC LIKE '%' AND PMS_BUYER
LIKE '%' AND
PMS_SELLER LIKE '%' AND AY_VAL_ACT_ROLLUP LIKE '%' AND
BY_VAL_ACT_ROLLUP LIKE '%' AND EY_VAL_ACT_ROLLUP
LIKE '%' AND Y4_VAL_ACT_ROLLUP LIKE '%' ORDER BY 'FSC','FSC' LIMIT

As you can see, all the variables are set as expected. Clicking the
next (for the next 20 items):

$_SESSION array: Array
(
[sqlqry] => SELECT * FROM Repair WHERE ALC LIKE '%' AND BP LIKE
'15' AND FSC LIKE '%' AND NIIN LIKE '%'
AND SGM_MMAC LIKE '%' AND IMS LIKE '%' AND SMC LIKE '%' AND PMS_BUYER
LIKE '%' AND
PMS_SELLER LIKE '%' AND AY_VAL_ACT_ROLLUP LIKE '%' AND
BY_VAL_ACT_ROLLUP LIKE '%' AND EY_VAL_ACT_ROLLUP
LIKE '%' AND Y4_VAL_ACT_ROLLUP LIKE '%' ORDER BY '','' LIMIT

As you can see, the two fields to order by are being dropped. Is there
a limit to the size of the array here? The reason for the LIMIT being
blank is that those values are dynamic and are added when I build the
actual sql string.

I am going to try using the individual session elements once I figure
out what the heck is going on with those order by elements.

Thanks

rk

Jul 17 '05 #7

P: n/a
redneck_kiwi wrote:

Taking some of your suggestions I get the following results:

[1] Verifying the contents of the session array:

First pass:
$_SESSION array: Array
(
[sqlqry] => SELECT * FROM Repair WHERE ALC LIKE '%' AND BP LIKE
'15' AND FSC LIKE '%' AND NIIN LIKE '%'
AND SGM_MMAC LIKE '%' AND IMS LIKE '%' AND SMC LIKE '%' AND PMS_BUYER
LIKE '%' AND
PMS_SELLER LIKE '%' AND AY_VAL_ACT_ROLLUP LIKE '%' AND
BY_VAL_ACT_ROLLUP LIKE '%' AND EY_VAL_ACT_ROLLUP
LIKE '%' AND Y4_VAL_ACT_ROLLUP LIKE '%' ORDER BY 'FSC','FSC' LIMIT

As you can see, all the variables are set as expected. Clicking the
next (for the next 20 items):

$_SESSION array: Array
(
[sqlqry] => SELECT * FROM Repair WHERE ALC LIKE '%' AND BP LIKE
'15' AND FSC LIKE '%' AND NIIN LIKE '%'
AND SGM_MMAC LIKE '%' AND IMS LIKE '%' AND SMC LIKE '%' AND PMS_BUYER
LIKE '%' AND
PMS_SELLER LIKE '%' AND AY_VAL_ACT_ROLLUP LIKE '%' AND
BY_VAL_ACT_ROLLUP LIKE '%' AND EY_VAL_ACT_ROLLUP
LIKE '%' AND Y4_VAL_ACT_ROLLUP LIKE '%' ORDER BY '','' LIMIT

As you can see, the two fields to order by are being dropped. Is there
a limit to the size of the array here? The reason for the LIMIT being
blank is that those values are dynamic and are added when I build the
actual sql string.

I am going to try using the individual session elements once I figure
out what the heck is going on with those order by elements.


I'm not sure what the limit is (if any) on session variables, but you're no
where near it. There must be something in your code that's removing the ORDER
BY fields.

Also, you might want to invest a bit of time making a more efficient SQL query
(like only have WHERE fields if you're actually searching them)

Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.