1

Topic: PHP + MS Access

Anyone have any experience with PHP, MS Access, and JS?

Proverbs 12:14 - Wise words bring many benefits, and hard work brings rewards.

Re: PHP + MS Access

yes. It's been awhile since I've connected to an Access DB.

I dream with an XML intereface

3

Re: PHP + MS Access

I have a select box that needs to display a selected value and have the ability to change other values from a db table.

Does this look right?

Here's my code so far:

==Form==
<span><select name="minorGroup">
<?php include ("include/dsp_minorGroupUpdate.php"); ?>
</select><label>Minor Group</label></span>

==Include file (dsp_minorGroupUpdate.php)==
<?php
function getOptions('tblMinorGroup', 'ID', 'minorGroupName', 'minorGroup');{
    global $conn; //the connection handle
    $id = $_GET['ID'];
    $minorGroupName = $_GET['minorGroupName'];
    if (empty('minorGroupName')) 'minorGroupName' = 'ID';
    $result = odbc_exec($conn, "SELECT ID as v, minorGroupName as d FROM tblMinorGroup") or die (odbc_error());
    if (odbc_error($conn) == FALSE) { die (odbc_errormsg($conn));}
    $i = empty($_POST['minorGroup']) ? NULL : trim ($_POST['minorGroup']);
    $return = '';
    while ($row = odbc_fetch_array($result)){
        $selected = $i == $row['v'] ? 'selected="selected"' : '';
        $return .= "\t<option value=\"$row[v]\" $selected>$row[d]</option>\r\n";
    }
return $return;
}
echo getOptions('tblMinorGroup', 'ID', 'minorGroup', 'minorGroup');
?>

I need of help. Thank you.

Proverbs 12:14 - Wise words bring many benefits, and hard work brings rewards.

Re: PHP + MS Access

looks right to me at first glance without seeing the table. Are you having any issues?

I dream with an XML intereface

Re: PHP + MS Access

Isn't that an errant semicolon before the left curly bracket?

GP wrote:

...
function getOptions('tblMinorGroup', 'ID', 'minorGroupName', 'minorGroup');{
...

Re: PHP + MS Access

gnelson wrote:

Isn't that an errant semicolon before the left curly bracket?

GP wrote:

...
function getOptions('tblMinorGroup', 'ID', 'minorGroupName', 'minorGroup');{
...

dang.. eyes like a hawk!

I dream with an XML intereface

Re: PHP + MS Access

Just got lucky ... Those darn semicolons get me all of the time.