Re: Please help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I understand your intent, but that is not really what is happening. The code 
changes I suggested did two things: 

1) Echo's the error statement that mysql produces

2) Echo's the actual SQL statement that is sent to the DB

you should be looking at #2 for answers, not your intended query. This 
'actual' query is what I'm referring to. 

-Micah 

On Friday 10 September 2004 10:46 am, Stuart Felenstein wrote:
> I think maybe there is an implied where in the
> generated code, but not in my statement.  I'm saying
> when I chose "ACCFIN" (as in the referred error
> message), the join should be looking at the referred
> table , value ACCFIN .  e.g. Code_Table.CodeID
> (ACCFIN) = MAIN_Table.CodeID (ACCFIN) return label.
>
> Here is the code, and I honestly am not trying to
> argue , just understand. Apologies if I'm belabouring
> the point.
>
> <?php
> require('LFW3_connection.php');
> require('qs_functions.php');
> @session_start();
> $err_string = "";
> $strkeyword = "";
> $sql = "";
> $sql_ext = "";
> $fields = array();
> $fields[0] = "JobID";
> $fields[1] = "CompanyName";
> $fields[2] = "CareerCategories";
> $fields[3] = "City";
> $fields[4] = "States";
> $fields[5] = "AreaCode";
> $fields[6] = "TaxTerm";
> $fields[7] = "PayRate";
> $fields[8] = "TravelReq";
> $fields[9] = "Details";
> $fields[10] = "PostStart";
> $fields[11] = "JobTitle";
> $arryitemvalue = array();
> $arryitemvalue[0] = "";
> $arryitemvalue[1] = "";
> $arryitemvalue[2] = "";
> $arryitemvalue[3] = "";
> $arryitemvalue[4] = "";
> $arryitemvalue[5] = "";
> $arryitemvalue[6] = "";
> $arryitemvalue[7] = "";
> $arryitemvalue[8] = "";
> $arryitemvalue[9] = "";
> $arryitemvalue[10] = "";
> $arryitemvalue[11] = "";
> $arryopt = array();
> $arryopt[0] = "";
> $arryopt[1] = "";
> $arryopt[2] = "";
> $arryopt[3] = "";
> $arryopt[4] = "";
> $arryopt[5] = "";
> $arryopt[6] = "";
> $arryopt[7] = "";
> $arryopt[8] = "";
> $arryopt[9] = "";
> $arryopt[10] = "";
> $arryopt[11] = "";
> $sql .= " SELECT ";
> $sql .= "   VendorJobs.JobID,";
> $sql .= "   VendorSignUp.CompanyName,";
> $sql .= "   StaIndTypes.CareerCategories,";
> $sql .= "   StaUSCities.City,";
> $sql .= "   USStates.States,";
> $sql .= "   VendorJobs.AreaCode,";
> $sql .= "   staTaxTerm.TaxTerm,";
> $sql .= "   VendorJobs.PayRate,";
> $sql .= "   staTravelReq.TravelReq,";
> $sql .= "   VendorJobDetails.Details,";
> $sql .= "   VendorJobs.PostStart,";
> $sql .= "   VendorJobs.JobTitle";
> $sql .= " FROM";
> $sql .= "   VendorJobs";
> $sql .= "   INNER JOIN VendorSignUp ON
> (VendorJobs.VendorID = VendorSignUp.VendorID)";
> $sql .= "   INNER JOIN StaIndTypes ON
> (VendorJobs.Industry = StaIndTypes.CareerIDs)";
> $sql .= "   LEFT OUTER JOIN StaUSCities ON
> (VendorJobs.LocationCity = StaUSCities.CityID)";
> $sql .= "   LEFT OUTER JOIN USStates ON
> (VendorJobs.LocationState = USStates.StateID)";
> $sql .= "   LEFT OUTER JOIN staTaxTerm ON
> (VendorJobs.TaxTerm = staTaxTerm.TaxTermID)";
> $sql .= "   INNER JOIN staTravelReq ON
> (VendorJobs.TravelReq = staTravelReq.TravelReqID)";
> $sql .= "   INNER JOIN VendorJobDetails ON
> (VendorJobs.JobID = VendorJobDetails.JobID)";
>
>
> $result = mysql_query($sql . " " . $sql_ext . " limit
> 0,1")  or
> die(mysql_error()."<br>".$sql." ".$sql_ext . " limit
> 0,1<br>");
> if (isset($_POST["QS_Submit"])) {
>     $filter_string = "";
>     $qry_string = "";
>     $i = 0;
>     while ($i < mysql_num_fields($result)) {
>         $meta = mysql_fetch_field($result);
>         $field_name = $meta->name;
>         $field_type = $meta->type;
>         if ((qsrequest("search_fd" . $i) != "") &&
> (qsrequest("search_fd" . $i) != "*")) {
>             $idata = qsrequest("search_fd" . $i);
>             if (strlen($idata) > 1) {
>                 if ($idata[strlen($idata) - 1] == "*")
> {
>                     $idata = substr($idata, 0,
> strlen($idata) - 1);
>                 }
>             }
>             $idata = str_replace("*", "%", $idata);
>             $irealdata = $idata;
>             if (qsrequest("search_optfd".$i) != "") {
>               $idata = qsrequest("search_optfd". $i) .
> $idata ;
>             }
>             $iopt = substr($idata, 0, 2);
>             if (($iopt == "<=") || ($iopt == "=<")) {
>                 $iopt = "<=";
>                 $irealdata = substr($idata, 2);
>             } elseif (($iopt == ">=") || ($iopt ==
> "=>")) {
>                 $iopt = ">=";
>                 $irealdata = substr($idata, 2);
>             } elseif ($iopt == "==") {
>                 $iopt = "=";
>                 $irealdata = substr($idata, 2);
>             } elseif ($iopt == "<>") {
>                 $irealdata = substr($idata, 2);
>             } elseif ($iopt == "^^") {
>                       $iopt = "*";
>             	$idata =  $iopt . $irealdata . $iopt; //
> Contain
>                   } elseif ($iopt == "^*") {
>                       $iopt = "*";
>             	$idata =  $irealdata . $iopt; // Start
> With
>                   } elseif ($iopt == "*^") {
>                       $iopt = "*";
>             	$idata =  $iopt . $irealdata ; // End
> With
>             } else {
>                 $iopt = substr($idata, 0, 1);
>                 if (($iopt == "<") || ($iopt == ">")
>
> || ($iopt == "=")) {
>
>                     $irealdata = substr($idata,1);
>                 } else {
>                     $iopt = "=";
>                 }
>             }
>         if (!strcasecmp($idata,"{current date and
> time}")) {
>             $idata = time();
>         } elseif (!strcasecmp($idata,"{current
> date}")) {
>             $idata = time();
>         } elseif (!strcasecmp($idata,"{current
> time}")) {
>             $idata = time();
>         }
>             if ($meta) {
>                 if ((strtolower($field_type) ==
> "timestamp")
>
>                   ||(strtolower($field_type) ==
>
> "datetime")
>
>                   ||(strtolower($field_type) ==
>
> "smalldatetime")
>
>                   ||(strtolower($field_type) ==
>
> "date")
>
>                   ||(strtolower($field_type) ==
>
> "time")
>
>                   ||(strtolower($field_type) ==
>
> "year")) {
>                     if ((($timestamp =
> strtotime($irealdata)) !== -1)) {
>                         if ($qry_string == "") {
>                             $qry_string = "search_fd"
> . $i . "=" . urlencode($idata);
>                             $filter_string =
> $field_name . " " . $iopt . " '" . $irealdata . "'";
>                         } else {
>                             $qry_string .=
> "&search_fd" . $i . "=" . urlencode($idata);
>                             $filter_string .= " and "
> . $field_name . " " . $iopt . " '" . $irealdata . "'";
>                         }
>                     } else {
>                         $err_string .=
> "<strong>Error</strong> while searching <strong>" .
> $field_name . "</strong>.<br>";
>                         $err_string .= "Description:
> Invalid DateTime.<br>";
>                     }
>                 } elseif (($meta->numeric) == 1) {
>                     if (is_numeric($irealdata)) {
>                         if ($qry_string == "") {
>                             $qry_string = "search_fd"
> . $i . "=" . $idata;
>                             $filter_string =
> $field_name . " " . $iopt . " " . $irealdata;
>                         } else {
>                             $qry_string .=
> "&search_fd" . $i . "=" . $idata;
>                             $filter_string .= " and "
> . $field_name . " " . $iopt . " " . $irealdata;
>                         }
>                     } else {
>                         $err_string .=
> "<strong>Error</strong> while searching <strong>" .
> $field_name . "</strong>.<br>";
>                         $err_string .= "Description:
> Type mismatch.<br>";
>                     }
>                 } elseif ((strtolower($field_type) ==
> "blob")
>
>                         ||(strtolower($field_type) ==
>
> "mediumblob")
>
>                         ||(strtolower($field_type) ==
>
> "longblob")) {
>                     if ($qry_string == "") {
>                         $qry_string = "search_fd" . $i
> . "=" . urlencode(stripslashes($idata));
>                         $filter_string = $field_name .
> " like '" . $irealdata . "%'";
>                     } else {
>                         $qry_string .= "&search_fd" .
> $i . "=" . urlencode(stripslashes($idata));
>                         $filter_string .= " and " .
> $field_name . " like '" . $irealdata . "%'";
>                     }
>                 } elseif ((strtolower($field_type) ==
> "varchar")
>
>                         ||(strtolower($field_type) ==
>
> "char")
>
>                         ||(strtolower($field_type) ==
>
> "text")
>
>                         ||(strtolower($field_type) ==
>
> "tinytext")
>
>                         ||(strtolower($field_type) ==
>
> "mediumtext")
>
>                         ||(strtolower($field_type) ==
>
> "string")
>
>                         ||(strtolower($field_type) ==
>
> "longtext")
>
>                         ||(strtolower($field_type) ==
>
> "nvarchar")
>
>                         ||(strtolower($field_type) ==
>
> "nchar")
>
>                         ||(strtolower($field_type) ==
>
> "ntext")) {
>                     if ($qry_string == "") {
>                         $qry_string = "search_fd" . $i
> . "=" . urlencode(stripslashes($idata));
>                         $filter_string = $field_name .
> " like '" . $irealdata . "%'";
>                     } else {
>                         $qry_string .= "&search_fd" .
> $i . "=" . urlencode(stripslashes($idata));
>                         $filter_string .= " and " .
> $field_name . " like '" . $irealdata . "%'";
>                     }
>                 } else {
>                     if ($qry_string == "") {
>                         $qry_string = "search_fd" . $i
> . "=" . urlencode(stripslashes($idata));
>                         $filter_string = $field_name .
> " = '" . $irealdata . "'";
>                     } else {
>                         $qry_string .= "&search_fd" .
> $i . "=" . urlencode(stripslashes($idata));
>                         $filter_string .= " and " .
> $field_name . " = '" . $irealdata . "'";
>                     }
>                 }
>             }
>         }
>         if (qsrequest("multisearch_fd" . $i) != "") {
>             if ($qry_string == "") {
>                 $qry_string = "multisearch_fd" . $i .
> "=" . qsrequest("multisearch_fd" . $i);
>             } else {
>                 $qry_string = $qry_string .
> "&multisearch_fd" . $i . "=" .
> qsrequest("multisearch_fd" . $i);
>             }
>         }
>         $i++;
>     }
>     if ($result > 0) {mysql_free_result($result);}
>     if ($err_string == "") {
>         if ($qry_string != "") {
>             $URL="./LFW3.php?" . $qry_string;
>         } else {
>             $URL="./LFW3.php";
>         }
>         header ("Location: $URL");
>         exit;
>     }
> } else {
> $i=0;
> while ($i < mysql_num_fields($result)) {
> $strkeyword = "";
> $iopt = "";
> $idata = "";
> if ((!isset($_GET["search_fd".$i])) &&
> (!isset($_POST["search_fd".$i]))) {
>     $arryitemvalue[$i] = "";
>     $arryopt[$i]="";
> } else {
>     # Check value for advance search
>     $idata = qsrequest("search_fd" . $i);
>     $iopt = substr($idata, 0, 2); // Get 2 of left
> keyword
>     if (($iopt == "<=") || ($iopt == "=<")){
>         $iopt  = "<=";
>         $strkeyword = substr($idata, 2);
>     }elseif (($iopt == ">=") || ($iopt == "=>")){
>         $iopt = ">=";
>         $strkeyword = substr($idata, 2);
>     }elseif ($iopt == "==" ){
>         $iopt = "==";
>         $strkeyword = substr($idata, 2);
>     }elseif ($iopt == "<>"){
>         $strkeyword = substr($idata, 2);
>     } else {
>         $startstrdata = substr(qsrequest("search_fd" .
> $i),0,1) ;
>         $endstrdata =
> $idata[strlen(qsrequest("search_fd" . $i)) - 1];
>         if (($startstrdata != "%" ) && ($endstrdata !=
> "%")){
>             if (($startstrdata == "<") ||
> ($startstrdata == ">") || ($startstrdata == "=")) {
>                 if ($startstrdata == "<") {
>                     $strkeyword = str_replace("<","",
> qsrequest("search_fd" . $i)) ;
>                     $iopt = "<";
>                 }elseif($startstrdata == ">")  {
>                     $strkeyword = str_replace(">","",
> qsrequest("search_fd" . $i)) ;
>                     $iopt = ">";
>                 } else {
>                     $strkeyword = str_replace("=","",
> qsrequest("search_fd" . $i)) ;
>                     $iopt = "=";
>                 }
>             }else {
>                 $arryitemvalue[$i] =
> qsrequest("search_fd". $i);
>                 $strkeyword = qsrequest("search_fd".
> $i);
>             }
>         }else {
>             if (($startstrdata == "%" ) &&
> ($endstrdata == "%")) {  # Contain Case
>                 $startstrdata = str_replace("%","",
> qsrequest("search_fd" . $i)) ;
>                 $strkeyword  =
> substr(qsrequest("search_fd" . $i),1,
> (strlen(qsrequest("search_fd" . $i))-2));
>                 $iopt = "^^" ;
>             }elseif (($startstrdata != "%" ) &&
> ($endstrdata == "%")) {  # Start With Case xx*
>                 $strkeyword  =
> substr(qsrequest("search_fd" . $i),0,
> (strlen(qsrequest("search_fd" . $i))-1));
>                 $iopt = "^*";
>             }elseif (($startstrdata == "%" ) &&
> ($endstrdata != "%")) { # End With Case *xx
>                 $strkeyword  =
> substr(qsrequest("search_fd" . $i),1,
> (strlen(qsrequest("search_fd" . $i))));
>                 $iopt = "*^";
>             }
>         }// end eheck one charator
>    }//end of check 2 first character
>    $arryitemvalue[$i] = $strkeyword;
>    $arryopt[$i] = $iopt;
> }
> $i += 1;
> }// end while
> if ($result > 0) {mysql_free_result($result);}
> }
> ?>
> <HTML>
> <HEAD>
> <Title>Search Page</Title>
> <link rel="stylesheet" type="text/css"
> href="LFW3_search.css">
>
> </HEAD>
> <BODY>
> <Center>
>
> <A NAME=top></A>
> <Form name="QS_Search_Form" method="post"
> action="./LFW3_search.php">
> <script language='javascript'
> src='Qwikcalendar.js'></script>
> <Table Border="0" Cellpadding="4" Cellspacing="1"
> BgColor="#D4D4D4">
>
> <tr>
> <td colspan="2" class="ThRows">Search Page</td>
> </tr>
> <?php
> $css_class = "\"TrOdd\"";
> if ($err_string != "") {
>     print "<tr>";
>     print "<td
> class=\"ThRows\"><Strong>Error:</Strong></td>";
>     print "<td class=" . $css_class . "
> align=Default>" . $err_string . "</td>";
>     print "</tr>";
> }
> ?>
> <tr>
> <td class="ThRows">CareerCategories</td>
> <?php
> if ((!isset($_GET["search_fd2"])) &&
> (!isset($_POST["search_fd2"]))) {
>     $itemvalue = "";
> } else {
>     $itemvalue = qsrequest("search_fd2");
> }
>
>     $cellvalue = "
> <select name=\"search_fd2\"><option value=\"\"" .
> qscheckselected("",$itemvalue,"selected") . ">Please
> Select</option>" . qsmysqlgen_listbox("  Select
> Distinct `CareerIDs`,`CareerCategories` From
> StaIndTypes
> ","search_fd2","CareerIDs","CareerCategories",$itemvalue)
> . "</select>" . "<input type=\"hidden\"
> name=\"multisearch_fd2\" value=\"\">";
>     if ($cellvalue == "") {
>         $cellvalue = "&nbsp;";
>     }
>     print "<td class=" . $css_class . " align=Default
>
> >" . $cellvalue . "</td>";
>
> ?>
> </tr>
> <tr>
> <td class="ThRows">City</td>
> <?php
> if ((!isset($_GET["search_fd3"])) &&
> (!isset($_POST["search_fd3"]))) {
>     $itemvalue = "";
> } else {
>     $itemvalue = qsrequest("search_fd3");
> }
>
>     $cellvalue = "<select
> name=\"search_optfd3\"><option value=\"^*\"" .
> qscheckselected("^*",$arryopt[3],"selected") .
> ">starts with</option><option value=\"==\"" .
> qscheckselected("==",$arryopt[3],"selected") . ">is
> equal to</option></select><input type=\"text\"
> name=\"search_fd3\" value=\"" .
> qsreplace_html_quote(stripslashes($arryitemvalue[3]))
> . "\">" . "<input type=\"hidden\"
> name=\"multisearch_fd3\" value=\"\">";
>     if ($cellvalue == "") {
>         $cellvalue = "&nbsp;";
>     }
>     print "<td class=" . $css_class . " align=Default
>
> >" . $cellvalue . "</td>";
>
> ?>
> </tr>
> <tr>
> <td class="ThRows">States</td>
> <?php
> if ((!isset($_GET["search_fd4"])) &&
> (!isset($_POST["search_fd4"]))) {
>     $itemvalue = "";
> } else {
>     $itemvalue = qsrequest("search_fd4");
> }
>
>     $cellvalue = "
> <select name=\"search_fd4\"><option value=\"\"" .
> qscheckselected("",$itemvalue,"selected") . ">Please
> Select</option>" . qsmysqlgen_listbox("  Select
> Distinct `StateID`,`States` From USStates
> ","search_fd4","StateID","States",$itemvalue) .
> "</select>" . "<input type=\"hidden\"
> name=\"multisearch_fd4\" value=\"\">";
>     if ($cellvalue == "") {
>         $cellvalue = "&nbsp;";
>     }
>     print "<td class=" . $css_class . " align=Default
>
> >" . $cellvalue . "</td>";
>
> ?>
> </tr>
> <tr>
> <td class="ThRows">TaxTerm</td>
> <?php
> if ((!isset($_GET["search_fd6"])) &&
> (!isset($_POST["search_fd6"]))) {
>     $itemvalue = "";
> } else {
>     $itemvalue = qsrequest("search_fd6");
> }
>
>     $cellvalue = "
> <select name=\"search_fd6\"><option value=\"\"" .
> qscheckselected("",$itemvalue,"selected") . ">Please
> Select</option>" . qsmysqlgen_listbox("  Select
> Distinct `TaxTermID`,`TaxTerm` From staTaxTerm
> ","search_fd6","TaxTermID","TaxTerm",$itemvalue) .
> "</select>" . "<input type=\"hidden\"
> name=\"multisearch_fd6\" value=\"\">";
>     if ($cellvalue == "") {
>         $cellvalue = "&nbsp;";
>     }
>     print "<td class=" . $css_class . " align=Default
>
> >" . $cellvalue . "</td>";
>
> ?>
> </tr>
> <tr>
> <td class="ThRows">JobTitle</td>
> <?php
> if ((!isset($_GET["search_fd11"])) &&
> (!isset($_POST["search_fd11"]))) {
>     $itemvalue = "";
> } else {
>     $itemvalue = qsrequest("search_fd11");
> }
>
>     $cellvalue = "<select
> name=\"search_optfd11\"><option value=\"^^\"" .
> qscheckselected("^^",$arryopt[11],"selected") .
> ">contains</option><option value=\"^*\"" .
> qscheckselected("^*",$arryopt[11],"selected") .
> ">starts with</option><option value=\"*^\"" .
> qscheckselected("*^",$arryopt[11],"selected") . ">ends
> with</option><option value=\"==\"" .
> qscheckselected("==",$arryopt[11],"selected") . ">is
> equal to</option></select><input type=\"text\"
> name=\"search_fd11\" value=\"" .
> qsreplace_html_quote(stripslashes($arryitemvalue[11]))
> . "\">" . "<input type=\"hidden\"
> name=\"multisearch_fd11\" value=\"\">";
>     if ($cellvalue == "") {
>         $cellvalue = "&nbsp;";
>     }
>     print "<td class=" . $css_class . " align=Default
>
> >" . $cellvalue . "</td>";
>
> ?>
> </tr>
> <tr>
> <td colspan="2" class="ThRows" align=Center>
> <input type="button" name="QS_Back" value="Back"
> OnClick="history.back()">&nbsp;&nbsp;
> <input type="submit" name="QS_Submit"
> value="Search">&nbsp;&nbsp;
> <input type="button" name="QS_Clear" value="Clear"
> OnClick="location='LFW3_search.php'">
> </td>
> </tr>
> </Table><br>
> </Form>
> <?php
> mysql_close($link);
> ?>
> <A NAME=bottom></A>
> </Center>
>
> </BODY>
> </HTML>
>
> index.php
>
> <HTML>
> <HEAD>
> <link rel="stylesheet" type="text/css"
> href="LFW3.css">
> <meta http-equiv="Content-Type" content="text/html;
> iso-8859-1">
>
> </HEAD>
> <BODY>
> <?php
> require('LFW3_connection.php');
> require('qs_functions.php');
> $err_string="";
> $sql = "";
> print "<Table Border=\"0\" Cellpadding=\"4\"
> Cellspacing=\"1\" BgColor=\"#D4D4D4\">";
> print "<tr>";
> print "<td class=\"ThRows\">" . "Page" . "</td>";
> print "</tr>";
> print "<UI>";
> $sql .= " SELECT ";
> $sql .= "   `VendorJobs`.`JobID`,";
> $sql .= "   `VendorSignUp`.`CompanyName`,";
> $sql .= "   `StaIndTypes`.`CareerCategories`,";
> $sql .= "   `StaUSCities`.`City`,";
> $sql .= "   `USStates`.`States`,";
> $sql .= "   `VendorJobs`.`AreaCode`,";
> $sql .= "   `staTaxTerm`.`TaxTerm`,";
> $sql .= "   `VendorJobs`.`PayRate`,";
> $sql .= "   `staTravelReq`.`TravelReq`,";
> $sql .= "   `VendorJobDetails`.`Details`,";
> $sql .= "   `VendorJobs`.`PostStart`,";
> $sql .= "   `VendorJobs`.`JobTitle`";
> $sql .= " FROM";
> $sql .= "   `VendorJobs`";
> $sql .= "   INNER JOIN `VendorSignUp` ON
> (`VendorJobs`.`VendorID` =
> `VendorSignUp`.`VendorID`)";
> $sql .= "   INNER JOIN `StaIndTypes` ON
> (`VendorJobs`.`Industry` =
> `StaIndTypes`.`CareerIDs`)";
> $sql .= "   LEFT OUTER JOIN `StaUSCities` ON
> (`VendorJobs`.`LocationCity` =
> `StaUSCities`.`CityID`)";
> $sql .= "   LEFT OUTER JOIN `USStates` ON
> (`VendorJobs`.`LocationState` =
> `USStates`.`StateID`)";
> $sql .= "   LEFT OUTER JOIN `staTaxTerm` ON
> (`VendorJobs`.`TaxTerm` = `staTaxTerm`.`TaxTermID`)";
> $sql .= "   INNER JOIN `staTravelReq` ON
> (`VendorJobs`.`TravelReq` =
> `staTravelReq`.`TravelReqID`)";
> $sql .= "   INNER JOIN `VendorJobDetails` ON
> (`VendorJobs`.`JobID` = `VendorJobDetails`.`JobID`)";
> $result = mysql_query($sql)
>           or die(mysql_error()."<br>".$sql."
> ".$sql_ext . " limit 0,1<br>");
> $num_rows = mysql_num_rows($result);
> $page_size = 20;
> $page_count = ceil($num_rows/$page_size);
> print "<UI>";
> if ($page_count > 0) {
>     $css_class = "";
>     for ($i = 1; $i <= $page_count ; $i++) {
>         if (($css_class) == "\"TrOdd\"") {
>             $css_class = "\"TrRows\"";
>         } else {
>             $css_class = "\"TrOdd\"";
>         }
>         print "<tr>";
>         print "<td class=". $css_class . "><a
> href=\"LFW3.php?page=" . $i . "\" >Page" . $i .
> "</a>";
>         print"</td>";
>         print"</tr>";
>     }
> } else {
>     $css_class = "\"TrRows\"";
>     print "<tr>";
>     print "<td class=". $css_class . "><a
> href=\"LFW3.php?page=1\" >Page1</a>";
>     print"</td>";
>     print"</tr>";
> }
> print "</UI>";
> print "</Table>";
> if ($result > 0 ) {mysql_free_result($result);}
> ?>
>
> </BODY>
> </HTML>
>
> --- Micah Stevens <micah@xxxxxxxxxxxxxxxxxx> wrote:
> > there is a WHERE on the last line of the statement
> > you sent me.
> >
> > Where's are in the form of:
> >
> > WHERE <value> <condition> <value>
> >
> > Yours is in the form:
> > WHERE <condition> <value>
> >
> > You're not providing anything to compare the latter
> > value to. You can imply
> > conditions in the join syntax for sure, but the fact
> > of the matter remains
> > you are in addition specifying a syntactically
> > incorrect WHERE statement at
> > the end.
> >
> > -Micah
> >
> > On Friday 10 September 2004 10:22 am, you wrote:
> > > Okay, I was under the impression that "where" is
> > > implied inthe joins xx.xx = xx.xx .  Is that not
> >
> > the
> >
> > > case ?
> > > As a matter of fact, there isn't even a where or
> >
> > like
> >
> > > in my query.  Then again myabe that's why I can
> >
> > see
> >
> > > *all* records but not run a search.
> > >
> > > Can you please provide an exmample of the column
> >
> > name
> >
> > > bteween where and like ?
> > >
> > > Thank you.
> > > Stuart
> > >
> > > --- Micah Stevens <micah@xxxxxxxxxxxxxxxxxx>
> >
> > wrote:
> > > > If you look at the query, there's no column name
> > > > between 'WHERE' and 'LIKE'
> > > > which is a syntax error. That's the problem.
> > > >
> > > >
> > > > Looks like your sql generator has some issues,
> >
> > or
> >
> > > > you didn't specify the WHERE
> > > > column properly. I'm not familiar with the
> >
> > system
> >
> > > > you're using, but keep in
> > > > mind, that mysql_error will usually not steer
> >
> > you
> >
> > > > wrong.
> > > >
> > > > -Micah
> > > >
> > > > On Friday 10 September 2004 10:03 am, Stuart
> > > >
> > > > Felenstein wrote:
> > > > > I had not, my apologies.  I think your post
> > > >
> > > > slipped
> > > >
> > > > > by.  Anyway, yes I have now inserted
> >
> > mysql_error()
> >
> > > > and
> > > >
> > > > > got my return.  Though I'm not entirely sure
> >
> > how
> >
> > > > to
> > > >
> > > > > fix it.
> > > > > Here is the error.
> > > > >
> > > > > You have an error in your SQL syntax. Check
> >
> > the
> >
> > > > manual
> > > >
> > > > > that corresponds to your MySQL server version
> >
> > for
> >
> > > > the
> > > >
> > > > > right syntax to use near 'Like 'ACCFIN'' at
> >
> > line 1
> >
> > > > > SELECT `VendorJobs`.`JobID`,
> > > > > `VendorSignUp`.`CompanyName`,
> > > > > `StaIndTypes`.`CareerCategories`,
> > > > > `StaUSCities`.`City`, `USStates`.`States`,
> > > > > `VendorJobs`.`AreaCode`,
> >
> > `staTaxTerm`.`TaxTerm`,
> >
> > > > > `VendorJobs`.`PayRate`,
> > > >
> > > > `staTravelReq`.`TravelReq`,
> > > >
> > > > > `VendorJobDetails`.`Details`,
> > > > > `VendorJobs`.`PostStart`,
> >
> > `VendorJobs`.`JobTitle`
> >
> > > > FROM
> > > >
> > > > > `VendorJobs` INNER JOIN `VendorSignUp` ON
> > > > > (`VendorJobs`.`VendorID` =
> > > >
> > > > `VendorSignUp`.`VendorID`)
> > > >
> > > > > INNER JOIN `StaIndTypes` ON
> > > >
> > > > (`VendorJobs`.`Industry` =
> > > >
> > > > > `StaIndTypes`.`CareerIDs`) LEFT OUTER JOIN
> > > > > `StaUSCities` ON (`VendorJobs`.`LocationCity`
> >
> > =
> >
> > > > > `StaUSCities`.`CityID`) LEFT OUTER JOIN
> >
> > `USStates`
> >
> > > > ON
> > > >
> > > > > (`VendorJobs`.`LocationState` =
> > > >
> > > > `USStates`.`StateID`)
> > > >
> > > > > LEFT OUTER JOIN `staTaxTerm` ON
> > > > > (`VendorJobs`.`TaxTerm` =
> > > >
> > > > `staTaxTerm`.`TaxTermID`)
> > > >
> > > > > INNER JOIN `staTravelReq` ON
> > > >
> > > > (`VendorJobs`.`TravelReq`
> > > >
> > > > > = `staTravelReq`.`TravelReqID`) INNER JOIN
> > > > > `VendorJobDetails` ON (`VendorJobs`.`JobID` =
> > > > > `VendorJobDetails`.`JobID`) where Like
> >
> > 'ACCFIN'
> >
> > > > limit
> > > >
> > > > > 0,1
> >
> > --------------------------------------------------
> >
> > > > > --- Micah Stevens <micah@xxxxxxxxxxxxxxxxxx>
> > > >
> > > > wrote:
> > > > > > did you make the change to the code I
> >
> > suggested?
> >
> > > > > > What does MySQL say the error
> > > > > > is?
> > > > > >
> > > > > > -Micah
> > > > > >
> > > > > >
> > > > > > On Friday 10 September 2004 07:49 am, Stuart
> > > > > >
> > > > > > Felenstein wrote:
> > > > > > > As I said this is a code generator
> > > >
> > > > (dbqwiksite).
> > > >
> > > > > > So,
> > > > > >
> > > > > > > describing the process for creating the
> >
> > code
> >
> > > > is
> > > >
> > > > > > > different.  The $sql is fine, as far as
> >
> > typos
> >
> > > > or
> > > >
> > > > > > > incorrect characterrs.  I've gone through
> > > >
> > > > those
> > > >
> > > > > > > statement very carefully.
> > > > > > > I've also tried to run a debug with no
> >
> > luck.
> >
> > > > > > > But I do know that there is something
> >
> > wrong
> >
> > > > with
> > > >
> > > > > > the
> > > > > >
> > > > > > > statement, since I can get a complete
> >
> > display
> >
> > > > of
> > > >
> > > > > > all
> > > > > >
> > > > > > > records, but can't search using criteria.
>
> === message truncated ===

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux