--- Bastien Koert <[EMAIL PROTECTED]> wrote: > > can you post the code that creates the sql > statement > > bastien > I'm posting the entire script. I hope it comes through legible. If not I can do an attachment so the format, line breaks will remain.
<?php session_start(); $currentPage = $_SERVER["PHP_SELF"]; require_once('Connections/myconn.php'); ?> <?php if (count($taxType) > 0 AND is_array($taxType)) { $s_ttype = "'".implode("','", $taxType)."'"; } if (count($degree) > 0 AND is_array($degree)) { $s_degree = "'".implode("','", $degree)."'"; } // begin Recordset $maxRows_rsCS = 10; $pageNum_rsCS = 0; if (isset($HTTP_GET_VARS['pageNum_rsCS'])) { $pageNum_rsCS = $HTTP_GET_VARS['pageNum_rsCS']; } $startRow_rsCS = $pageNum_rsCS * $maxRows_rsCS; $aWHERE = array(); if(isset($resAge)) $aWHERE[] = "Profiles_Rez.ResAge >= DATE_SUB(CurDate(), Interval ($resAge) DAY)"; if(isset($workAuth)) $aWHERE[] = "Prof.WorkAuth IN ($workAuth)"; if(isset($expLevel)) $aWHERE[] = "Prof.WorkExp IN ($expLevel)"; if(isset($jobCat)) $aWHERE[] = "Profiles_Industries.IndID IN ($jobCat)"; if(isset($ac1)) $aWHERE[] = "Left (SignUp.Telephone, 3) LIKE '%$ac1%'"; if(isset($ac2)) $aWHERE[] = "Left (SignUp.Telephone, 3) LIKE '%$ac2%'"; if(isset($ac3)) $aWHERE[] = "Left (SignUp.Telephone, 3) LIKE '%$ac3%'"; if(isset($zc1)) $aWHERE[] = "SignUp.zip_code LIKE '%$zc1%'"; if(isset($zc2)) $aWHERE[] = "SignUp.zip_code LIKE '%$zc2%'"; if(isset($zc3)) $aWHERE[] = "SignUp.zip_code LIKE '%$zc3%'"; if(isset($s_ttype)) $aWHERE[] = "Profiles_TTerm.TTermID IN ($s_ttype)"; if(isset($s_degree)) $aWHERE[] = "Prof.Edu IN ($s_degree)"; if(isset($school1)) $aWHERE[] = "Profiles_Schools.School LIKE '%$school1%'"; if(isset($school2)) $aWHERE[] = "Profiles_Schools.School LIKE '%$school2%'"; if(isset($school3)) $aWHERE[] = "Profiles_Schools.School LIKE '%$school3%'"; if(isset($cityReg1)) $aWHERE[] = "SignUp.City LIKE '%$cityReg1%'"; if(isset($cityReg2)) $aWHERE[] = "SignUp.City LIKE '%$cityReg2%'"; if(isset($cityReg3)) $aWHERE[] = "SignUp.City LIKE '%$cityReg3%'"; if(isset($stateReg1)) $aWHERE[] = "SignUp.State IN ($stateReg1)" ; if(isset($stateReg2)) $aWHERE[] = "SignUp.State IN ($stateReg2)"; if(isset($stateReg3)) $aWHERE[] = "SignUp.State IN ($stateReg3)"; if(isset($reloc)) $aWHERE[] = "Prof.Relo LIKE '%$reloc%'"; if(isset($stateReloc1)) $aWHERE[] = "Prof.State1 IN ($stateReloc1)"; if(isset($stateReloc1)) $aWHERE[] = "Prof.State2 IN ($stateReloc1)"; if(isset($stateReloc1)) $aWHERE[] = "Prof.State3 IN ($stateReloc1)"; if(isset($stateReloc2)) $aWHERE[] = "Prof.State1 IN ($stateReloc2)"; if(isset($stateReloc2)) $aWHERE[] = "Prof.State2 IN ($stateReloc2)"; if(isset($stateReloc2)) $aWHERE[] = "Prof.State3 IN ($stateReloc2)"; if(isset($payAnnLow)) $aWHERE[] = "Prof.SalaryAnnual IN ($payAnnLow)" ; if(isset($payAnnHigh)) $aWHERE[] = "Prof.SalaryAnnualHigh IN ($payAnnHigh)" ; if(isset($payHourLow)) $aWHERE[] = "Prof.SalaryHourly LIKE '%$payHourLow%'"; if(isset($payHourHigh)) $aWHERE[] = "Prof.SalaryHourlyHigh LIKE '%$payHourHigh%'"; if(isset($title1)) $aWHERE[] = "Profiles_JobTitles.CurrentJobT LIKE '%$title1%'"; if(isset($title2)) $aWHERE[] = "Profiles_JobTitles.SeekingJobT LIKE '%$title2%'"; if(isset($title2)) $aWHERE[] = "Profiles_JobTitles.AltJobT1 LIKE '%$title2%'"; if(isset($title2)) $aWHERE[] = "Profiles_JobTitles.AltJobT2 LIKE '%$title2%'"; if(isset($title3)) $aWHERE[] = "Profiles_JobTitles.SeekingJobT LIKE '%$title3%'"; if(isset($title3)) $aWHERE[] = "Profiles_JobTitles.AltJobT1 LIKE '%$title3%'"; if(isset($title32)) $aWHERE[] = "Profiles_JobTitles.AltJobT2 LIKE '%$title3%'"; if(isset($sCanFirst)) $aWHERE[] = "SignUp.firstname LIKE '%$sCanFirst%'"; if(isset($sCanLast)) $aWHERE[] = "SignUp.lastname LIKE '%$sCanLast%'"; if(isset($sCanEmail)) $aWHERE[] = "SignUp.email LIKE '%$sCanEmail%'"; if(isset($sCanEmail)) $aWHERE[] = "Profiles_AddContacts.eml2 LIKE '%$sCanEmail%'"; if(isset($sCanEmail)) $aWHERE[] = "Profiles_AddContacts.eml3 LIKE '%$sCanEmail%'"; if(isset($skill1)) $aWHERE[] = "Profiles_Skicerts.SkilCerts LIKE '%$skill1%'"; if(isset($skill2)) $aWHERE[] = "Profiles_Skicerts.SkilCerts LIKE '%$skill2%'"; if(isset($skill3)) $aWHERE[] = "Profiles_Skicerts.SkilCerts LIKE '%$skill3%'"; mysql_select_db($database_myconn, $myconn); $query_rsCS = "SELECT StaIndTypes.CareerCategories, SignUp.firstname, SignUp.lastname, Profiles_JobTitles.CurrentJobT, Profiles_Rez.ResAge, Profiles_Skicerts.SkilCerts, Profiles_AddContacts.Eml2, Profiles_Schools.School, staTaxTerm.TaxTerm, SignUp.City, StaExp.ExpTerm, USStates.States, Prof.ProfileName, StaWorkStatus.Auth FROM Prof INNER JOIN Profiles_Industries ON (Prof.ProfileID = Profiles_Industries.ProfileID) INNER JOIN StaIndTypes ON (Profiles_Industries.IndID = StaIndTypes.CareerIDs) INNER JOIN SignUp ON (Prof.LurkID = SignUp.SignUpID) INNER JOIN USStates ON (SignUp.State = USStates.StateID) INNER JOIN Profiles_JobTitles ON (Prof.ProfileID = Profiles_JobTitles.ProfileID) INNER JOIN Profiles_Rez ON (Prof.ProfileID = Profiles_Rez.ProfileID) INNER JOIN Profiles_Skicerts ON (Prof.ProfileID = Profiles_Skicerts.ProfileID) INNER JOIN Profiles_AddContacts ON (Prof.ProfileID = Profiles_AddContacts.ProfileID) INNER JOIN Profiles_Schools ON (Prof.ProfileID = Profiles_Schools.ProfileID) INNER JOIN Profiles_TTerm ON (Prof.ProfileID = Profiles_TTerm.ProfileID) INNER JOIN staTaxTerm ON (Profiles_TTerm.TTermID = staTaxTerm.TaxTermID) INNER JOIN StaExp ON (Prof.WorkExp = StaExp.ExpID) INNER JOIN StaWorkStatus ON (Prof.WorkAuth = StaWorkStatus.AuthID)"; print_r($query_rsCS); if(!empty($aWHERE)); $query_rsCS .= ' WHERE '.implode(' AND ',$aWHERE); print_r($aWHERE); $query_limit_rsCS = sprintf("%s LIMIT %d, %d", $query_rsCS, $startRow_rsCS, $maxRows_rsCS); print_r($query_limit_rsCS); $rsCS = mysql_query($query_limit_rsCS, $Pmmodel) or die(mysql_error()); print_r($rsCS); $row_rsCS = mysql_fetch_assoc($rsCS); print_r($row_rsCS); if (isset($_GET['totalRows_rsCS'])) { $totalRows_rsCS = $_GET['totalRows_rsCS']; } else { $all_rsCS = mysql_query($query_rsCS); $totalRows_rsCS = mysql_num_rows($all_rsCS); } $totalPages_rsCS = ceil($totalRows_rsCS/$maxRows_rsCS)-1; $queryString_rsCS = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_rsCS") == false && stristr($param, "totalRows_rsCS") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_rsCS = "&" . htmlentities(implode("&", $newParams)); } } print_r($queryString_rsCS); $queryString_rsCS = sprintf("&totalRows_rsCS=%d%s", $totalRows_rsCS, $queryString_rsCS); // end Recordset ?> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <table width="700" border="1" cellpadding="2" cellspacing="2" bordercolor="#CCCCCC"> <tr> <th scope="row"> </th> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <?php do { ?> <tr> <th scope="row"><div align="left"><?php echo $row_rsCS['firstname']; ?></div></th> <td><?php echo $row_rsCS['lastname']; ?></td> <td><?php echo $row_rsCS['City']; ?></td> <td><?php echo $row_rsCS['States']; ?></td> <td><?php echo $row_rsCS['ProfileName']; ?></td> <td> </td> <td> </td> <td> </td> </tr> <?php } while ($row_rsCS = mysql_fetch_assoc($rsCS)); ?> </table> <table border="0" width="50%" align="center"> <tr> <td width="23%" align="center"><?php if ($pageNum_rsCS > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_rsCS=%d%s", $currentPage, 0, $queryString_rsCS); ?>">First</a> <?php } // Show if not first page ?></td> <td width="31%" align="center"><?php if ($pageNum_rsCS > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_rsCS=%d%s", $currentPage, max(0, $pageNum_rsCS - 1), $queryString_rsCS); ?>">Previous</a> <?php } // Show if not first page ?></td> <td width="23%" align="center"><?php if ($pageNum_rsCS < $totalPages_rsCS) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_rsCS=%d%s", $currentPage, min($totalPages_rsCS, $pageNum_rsCS + 1), $queryString_rsCS); ?>">Next</a> <?php } // Show if not last page ?></td> <td width="23%" align="center"><?php if ($pageNum_rsCS < $totalPages_rsCS) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_rsCS=%d%s", $currentPage, $totalPages_rsCS, $queryString_rsCS); ?>">Last</a> <?php } // Show if not last page ?></td> </tr> </table> </body> </html> <?php mysql_free_result($rsCS); ?> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php