Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL to MS Access

Status
Not open for further replies.

bigcat48

Programmer
Aug 27, 2008
72
US
All - I found this code from another forum and it works with MYSQL and PHP.

Could someone help with the conversion of this code for usage in PHP and MS ACCESS?

Thanks.

Code:
MYSQL QUERY TO GET ALL AVAILABLE OPTIONS
mysql_select_db($database_siteConn, $siteConn);
$query_rsGetfeatures = "SELECT options.optionID, options.option FROM options_group INNER JOIN options ON options_group.optionID = options.optionID WHERE options_group.option_typeID = 1 AND formOption = 1";
$rsGetfeatures = mysql_query($query_rsGetfeatures, $siteConn) or die(mysql_error());
$row_rsGetfeatures = mysql_fetch_assoc($rsGetfeatures);
$totalRows_rsGetfeatures = mysql_num_rows($rsGetfeatures);

SELECT LIST

<select name="option[]" size="15" multiple id="option[]">
<?php do { ?>
<option value="<?php echo $row_rsGetfeatures['optionID']?>"
<?php echo (in_array($row_rsGetfeatures['optionID'], $on))? 'selected':''; ?>>
<?php echo $row_rsGetfeatures['option']?></option>
<?php
} while ($row_rsGetfeatures = mysql_fetch_assoc($rsGetfeatures));
$rows = mysql_num_rows($rsGetfeatures);
if($rows > 0) {
$row_rsGetfeatures = mysql_fetch_assoc($rsGetfeatures);
} 

MYSQL QUERY TO GET STORED VALUES

mysql_select_db($database_siteConn, $siteConn);
$query_rsGetStored = "SELECT options.optionID, options.option FROM options_group WHERE options_group.vehicleID = '". $_SESSION['vehicleID'] . "' AND formOption = 1";
$rsGetStored = mysql_query($query_rsGetStored, $siteConn) or die(mysql_error());
$row_rsStored = mysql_fetch_assoc($rsGetStored);
$totalRows_rsGetStored = mysql_num_rows($rsGetStored);

 
You need to check out the ODBC interface in php. The SQL will be pretty much the same.
The online manual has examples at and the site should help you out with and issues around the connection string.
If you have any SQL issues best post them in the msaccess forum (preseume there is one)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top