Re: Please help
| From: | Micah Stevens | Date: | Fri, 10 Sep 2004 20:20:59 +0000 |
| Subject: | Re: Please help | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-36156@lists.php.net to get a copy of this message | ||
echo $sql." ".$sql_ext;
Read the docs:
http://www.php.net/echo
http://www.php.net/mysql_query
On Friday 10 September 2004 01:18 pm, you wrote:
> Now that I'm not getting an invalid error message any
> longer, how can I get it to echo the sql statement ?
>
> Stuart
>
> --- Micah Stevens <micah@raincross-tech.com> wrote:
> > 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) ==
>
> === message truncated ===