Pull Down Menu with ODBC query

Pull Down Menu with ODBC query

am 11.08.2008 22:14:12 von kitfox69

I am having trouble getting this script to populate the query data into a pull down menu.

The SQL script works fine and displays the data with odbc_result_all but will not put it in the menu.

Script is as follows:

$conn = odbc_connect("HOMES", "", "");
$billdate = $_POST[ 'billdate' ];
$query = ("SELECT DISTINCT sls_his_cust_id FROM sls_his where sls_his_prchdat_alt = $billdate");
$result = odbc_exec($conn, $query);

echo "

";
echo "
";
?>

Any ideas?

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

RE: Pull Down Menu with ODBC query

am 11.08.2008 22:42:49 von kitfox69

BTW I want to make sure I am doing this correctly...

with that current script (edited below with your fix) will I be able to pass that selection on into a further PHP page? I do not see how without assigning a variable to it and passing it with POST... how would I go about this?
-------------- Original message ----------------------
From: "Simcha"
>
> odbc_fetch_array() returns an associative array, so will you need to use
> $row[' sls_his_cust_id'] instead of $row[0].
>
>
>
> -----Original Message-----
> From: kitfox69@comcast.net [mailto:kitfox69@comcast.net]
> Sent: Monday, August 11, 2008 10:14 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] Pull Down Menu with ODBC query
>
> I am having trouble getting this script to populate the query data into a
> pull down menu.
>
> The SQL script works fine and displays the data with odbc_result_all but
> will not put it in the menu.
>
> Script is as follows:
>
> > $conn = odbc_connect("HOMES", "", "");
> $billdate = $_POST[ 'billdate' ];
> $query = ("SELECT DISTINCT sls_his_cust_id FROM sls_his where
> sls_his_prchdat_alt = $billdate");
> $result = odbc_exec($conn, $query);
>
> echo "

";
> echo " > Results\">
";
> ?>
>
> Any ideas?
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.138 / Virus Database: 270.6.0/1604 - Release Date: 11/08/2008
> 05:50
>


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

Re: Pull Down Menu with ODBC query

am 11.08.2008 22:57:41 von Dan Shirah

------=_Part_78757_29289583.1218488261475
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Try something like this:





------=_Part_78757_29289583.1218488261475--

Re: Pull Down Menu with ODBC query

am 11.08.2008 23:59:16 von kitfox69

Thanks everyone for your help so far.

The last two responses I got were great and worked. However I stuck with my original script with the small $row fix presented earlier and it works great.

The only problem I see with the last two are that there is no scripting to push to the next page like I have set.

Saying that here is what I currently have:

$conn = odbc_connect("HOMES", "", "");
$billdate = $_POST[ 'billdate' ];
$query = ("SELECT DISTINCT sls_his_cust_id FROM sls_his where sls_his_prchdat_alt = $billdate");
$result = odbc_exec($conn, $query);

echo "

";
echo "
";
?>

I need to know how to name the selection so I can push it to the next page using the submit button.

The next page so far is as follows:

$conn = odbc_connect("HOMES", "", "");
$sls_his_cust_id = $_POST[ 'sls_his_cust_id' ];
$query = ("SELECT sls_his_d2_nam,
cust_phone_no,
cust_phone_no_2,
cust_phone_no_3,
sls_his_invc_no,
sls_his_so_bdat,
sls_his_d2_adrs_1,
sls_his_d2_adrs_2,
sls_his_d2_city,
sls_his_d2_state,
sls_his_d2_zip_cod,
slm_nam,
sls_his_pft_ctr,
sls_his_prchdat_alt
FROM sls_his , cust , slm
where CUST_ID = SLS_HIS_CUST_ID
AND slm = sls_his_slm_1
and sls_his_cust_id = $sls_his_cust_id");
$result = odbc_exec($conn, $query);
odbc_result_all($result)
?>

I need to be able to pass the selected CUSTID on to this page so I can display all the data pertinent to that customer... also I would like to be able to use the billdate that was present earlier but am not sure how to push it through again...

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